Agent gets stuck in center of crowd

Hello, I currently have a system where player can possess units and use WASD to move them around. Units that are not possessed by the player follows the main unit. However sometimes the main unit gets stuck in the center, unable to move around. I am currently using AIPath and RVOController. I move the player unit by calling Move() method on the AIPath, and other units by setting their destination. Is there a built-in solution to make the main unit always push other units?


(additional screenshots, couldn’t add to post because of new-user restriction)


not official advise at all but I never had any good results with RVO, I always had an scenario here and there where they all would get stuck, what did work for me and solved 100% of my problems was to allow them to bump into each other but create a slippery material for their rigidbody (a material with 0 friction), that way they can easily walk together without ever getting stuck, it also helps a lot when they need to cross gaps, now I can have hundreds of characters walking in one direction and crossing doors orderly

I am currently using CharacterController for the movement. I’ll wait for the dev’s answer, If there are no other solutions I may try this, although it’s a bit hacky. Thanks

This is a really interesting approach. I wonder if it would make sense to combine RVO and the slippery material for the rigidbody? Would we get the seemingly great early avoidance from RVO and the failsafe if they bumped into each other from the material? In my experience, RVO collisions also aren’t the greatest. It seems that once they collide it’s quite a challenge for agents to move past each other, especially if we’re talking about larger groups. Then again, that might depend on the wanted outcome of the game. I wonder what @aron_granberg thinks about this.

I tried that too, RVO created some sort of high friction collider, so they would all get stuck anyway even with the slippery collider (assuming that they bump into the RVO first), and if they bump into each other anyway (so the slippery collider comes into effect) you don’t need RVO, so I don’t see why use both together.

RVO works great when everyone is moving, the issues for me would come when they all need to stop at certain points or cross narrow paths like doors, but a slippery material as I said solved all the issues and improved performance a lot as after that I had no need for any RVO calculation, totally removed that and they still move great together. After discovering that I never used RVO again, slippery materials had huge advantages in my specific case (large crowds walking together to an specific point), occasionally my character also needs to be avoided, for that I have a gameobject with an obstacle layer collider, which I turn on, with that every other character will avoid getting close to it like it is an obstacle, I spent weeks trying to get the perfect crowd behaviour and that is what I went with as opposed to use RVO (and that is after using RVO a lot, but as mentioned it would regularly let me down with mobs getting stuck)

Hey @aron_granberg, can I get your opinion on this?


Sorry for the late reply.

For controlling a local avoidance agent manually, I would instead suggest to set rvoController.velocity directly using your WASD input. That will mark that agent as being manually controlled and the local avoidance system will make other agents move out of the way.

See RVOController - A* Pathfinding Project

1 Like

That worked flawlessly, thanks!