enemy now can walk on slopes

This commit is contained in:
Rendo 2025-07-27 21:11:10 +05:00
commit eec69524ee
4 changed files with 35 additions and 20 deletions

View file

@ -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