Godot Version
4.3.stable
My Problem
Hello, I’m trying to make a top down game where you move characters with the mouse. I’m using NavigationAgent and NavigationRegion to make characters move to where the player clicks but, they keep getting stuck on corners.
Is there a more appropriate way to deal with corners when it comes to 2D navigation? The characters have a Circle CollisionShape with a Radius of 12; the NavigationRegion is also baked with the Radius property in the Agents section set to 12. I have also already set the character’s motion mode to floating and the Wall Min Slide Angle to 0, yet they keep getting stuck on corners.
Video demonstrating the problem
The Character’s Code
func _physics_process(delta: float) -> void:
if navigation_agent_2d.is_navigation_finished():
pass
else:
_set_navigation_path()
move_and_slide()
func _set_navigation_path() -> void:
var next_path = navigation_agent_2d.get_next_path_position()
var new_velocity = global_position.direction_to(next_path) * 50
navigation_agent_2d.set_velocity(new_velocity)
func _on_navigation_agent_2d_velocity_computed(safe_velocity: Vector2) -> void:
velocity = safe_velocity