Non-circular agent local avoidance

Hello,

I’m trying to utilize A* Pathfinding Project Pro in a car game, where multiple cars are racing along a straight track. RVO avoidance works great, but it uses agents with circular radius. The cars in the game are rectangles with 2:1 or 5:2 proportions. RVO works great, but when the cars are next to each other they try to avoid one another, even though visually they have a lot of space.

How can I utilize local avoidance on agents that fit in a box rather than a circle?

Hi

The RVO algorithm unfortunately assumes a circular agent and is not easily adapted to other types of shapes. In any case it is a very bad model for a racing game because in the RVO model agents can change their velocity instantly. This means that it would be possible for your racing cars to stop immediately, which is not very realistic. I would recommend some other kind of local steering behaviour. Take a look at Unity Steer for example: https://github.com/ricardojmendez/UnitySteer.

Hi Aron,

The thing is, the cars are not moving in world space - they stay in a fixed, rectangular area, that is a battlefield and move within it, while the enviroment moves around them. So while the cars are not moving to a new location their position in world space is the same. The movement of the cars is simulated by animation and vfx. The game is also turn based - at one time only one car is traversing the battlefield, the other cars just need to make way for it using RVO. The game logic is also only in 2D, the 3rd axis is only used for visual effects.

Is there any way to modify the algorithm to work in this use case? The algorithm is fine, all I need is for the agents to avoid other agents based on a rectangular shape, not a circular one.

Hi

Hm… Ok.
Well, in any case, while it is technically possible to modify the RVO algorithm to work with any arbitrary shape, doing that requires a lot of math (which is why circles are used in the first place as they are comparatively simple) and it’s probably easier to write some other domain specific local avoidance system in that case.