Navigation Agents go out of bound of navigation mesh with avoidance

Godot Version



So for the past couple of hours I tried researching the navigation agent. My dream behaviour would be the wc3 units, which seem to wait if there is a unit in front blocking its path if there is no other way around. However I tried using the avoidance in the navigation agent and instead of waiting they seem to push eachother around in chokes, even going out of bounds of the navigation mesh.

Heres a clip of what I mean:

I tried thinking of a solution to this for example: If the optimal velocity is different than the safe velocity (aka the path is being blocked) set velocity zero. Which works except that the minion in front also doesnt have the optimal path → total stand still.

Any ideas of how I could basically make: If the behind minion (has a longer path) stand still if there is a minion in front blocking its optimal path?

I dont want to enable collision because of performance issue

You could try adding all the ones that being blocked to an array, find the one with the shortest path to target and only let that one move.
Once it moved out of the way it wouldn’t be added to the array (since it’s not blocked anymore) so the next blocked could move and so on…
Don’t know if it would work, just an idea.

1 Like