Prevent crowd agents from pushing each other


We’re trying to build a multiplayer point and click game. We implemented recast-detour for navmesh and pathfinding. Everything seems to work fine but when two players come near each other (or the path of one crosses the point where the other stands) the moving player, instead of going around the standing player, pushes the other out of the way (changes the other’s position).

I tried to play with agent properties (radius, separation weight, query distance etc…) to no avail (the problem becomes somewhat milder but doesn’t go away).

is there any way to avoid this? @Cedric ? :slight_smile:

I would try to add an obstacles at the position of non-moving characters.
(and of course, remove it before setting a new destination)
I believe, with a cylindrical obstacle with a radius of the same value as the agent, it should work.
but, I don’t know your use case. If there are 100s of characters, this might be an issue because of the obstacle count limit and the number of navmesh recomputation because of obstacles added/removed.

also, did you try to set a different value to separationWeight and collisionQueryRange ?

EDIT: I re-read your message and saw you already did.

Hey man, thanks for the reply.

I thought about this too but the same pushing thing happens when characters are moving too.

We’re not planning to have 100s of characters in the same area at the same time so adding an obstacle to standing characters and removing it when they move would at least make it better than it is now (what is the limit by the way? any idea?)

Yeah, they just change when/where the pushing happens, but don’t prevent it. :slight_smile: