[NavigationAgent2D] Agents get bugged mid-route

Godot Version



I have NavigationAgent2D with avoidance enabled.
While nearing the target, sometimes agents get bugged like below.
I suppose it is due to bad settings but I don’t know which.


Thanks a lot.

That crossed path debug looks more like your navigation mesh edges got merged wrong, common cause is overlap, and now your agent is just dangling in place between the positions.

1 Like

I enabled mesh debugging, they are going off route and then getting stuck. Is this about mesh edges? If so what can I do about that? I bake my obstacles each time they are added to the map.


By the way issue disappears when i disable avoidance.

So what avoidance related objects did you add that were not mentioned.

Avoidance runs independently of the navigation mesh so the 2 are not related in the issue.

The most likely cause is that another agent or obstacle is added and due to the time horizon and the space being blocked the agent slows down and/or cant reach the position.

Hey smix8, thanks a lot for your response, and all the hard work that you put in the engine.

Avoidance objects are tilemaps with collision, but even though there are no objects in the path agents keep getting stuck at the edges of polygons.


Here is my agent settings, time horizon for obstacles is 0.

The movement bug looks more like that the NavigationAgent can not reach the path point and over- or undershoots the position on each update getting stuck on its current index. You can increase the desired distances to test this.

The time horizon is the only avoidance-related property that can affect the movement speed of an agent to slow down. If you set it to a very low value or even zero that effect is removed.