Most appropriate solution for unit avoidance

Hi all,

I have successfully integrated AStar into my game, using a grid graph over a terrain. Since all movement in the game uses physics via wheelcolliders, I am simply iterating through a completed path’s nodes to determine forces to apply (torque, drive, brake).

This all works great and gets me most of the way, the issue is with unit avoidance.
Seems the RVO approach will be hard to integrate into this model as, from the examples I have seen so far, the position is set directly on a transform having been modified via the RVOController.

From the docs:
“In 4.x you can use it together with Rigidbody or CharacterController components. Keep in mind that the local avoidance system does not use colliders at all and will not try to avoid them.”

So perhaps an upgrade to 4 will help but obviously want to get some guidance here before shelling out.

I will most likely only have a handful of AI units to deal with at any time, so was wondering if a full graph scan is feasible, treating units as obstacles…? (Initial test with this seemed feasible performance wise, but unless I have missed something, if a unit is treated as an obstacle, it will always be inside its own ‘unreachable’ bubble)

Any insight greatly appreciated…


From your description it sounds like you are dealing with vehicles. The problem with vehicles is that they cannot change their velocities very quickly. Usually you want a vehicle to move in an arch if you want it to change direction.

The RVO system (and most other local avoidance systems) assume that the agents can change their velocities very quickly and is thus more suitable for e.g humans.

What I have found works best for vehicles is to forget about avoiding collisions entirely, but try to move other vehicles out of the way. In essence it works like this: a vehicle moves along its path and regularly predicts where other vehicles will be in the future. If it detects that another vehicle is on a collision course with it it should either try to stop to let the other vehicle past, or move faster to get ahead of the other vehicle or if it was originally entirely stationary, it should try to move out of the way for the other vehicle. There are some difficulties, for example one has to make sure that 2 vehicles don’t try to stop for each other as that would lead to neither of them being able to move.
The game Company of Heroes is a good game to look at, they have very nice vehicle movement.

That is a problem as you have noted. It is technically possible to do this if you make sure that the graph is always updated so that the navmesh below the agent itself is not blocked when it requests a path, but it can easily be too slow.
I’m afraid I do not have a good solution for this.

All in all, I do not think a 4.x upgrade will help you with this, unless I am wrong about how your vehicles move in the section above.

Hi Aron, thanks for response. Yes I am dealing with vehicles as you realised. Seems like I will need to have some custom raycast logic ahead of vehicles to get them to pause if detecting others - hopefully the frontmost vehicles in such a jam will be able to keep moving and free up the chain.

As a last resort, if not able to move for a period of time, perhaps send vehicle to a temporary location nearby and then try again…

Will give it a go.