enemy now can walk on slopes
This commit is contained in:
parent
81d5c5f0ba
commit
eec69524ee
4 changed files with 35 additions and 20 deletions
|
@ -13,8 +13,6 @@ func _physics_process(delta: float) -> void:
|
|||
if navigation_agent.is_navigation_finished(): return
|
||||
|
||||
if navigation_agent.is_target_reachable():
|
||||
var direction_to_next = (navigation_agent.get_next_path_position() - move_target.global_position).normalized()
|
||||
var delta_angle = clamp(move_target.basis.z.signed_angle_to(direction_to_next,Vector3.UP),-rotation_speed,rotation_speed)
|
||||
|
||||
move_target.rotation.y += delta_angle
|
||||
move_target.global_position += move_target.basis.z * max_speed * delta
|
||||
var pos = navigation_agent.get_next_path_position()
|
||||
move_target.look_at(pos)
|
||||
move_target.global_position += move_target.global_position.direction_to(pos) * max_speed * delta
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue