How do I make AI objects not walk on top of each other?
In this screenshot, you can see that all of the AI objects are happily doing their thing. However... ...in this screenshot, they are on top of each other. This happens when they reach their destination, and for some reason gravity will not work for them, so they can't fall down. What is causing this, and how can I stop it?
Thanks! P.S. I'm using the A* Unity Pathfinding Project for the AI.
Answer by BowlerBitesLane · Sep 12, 2015 at 07:13 PM
Have you tried adjusting the stopping distance of the NavMeshAgent components of the characters?
http://docs.unity3d.com/ScriptReference/NavMeshAgent-stoppingDistance.html
If that's not enough, you could add a script component that uses the onTriggerEnter method that will GetComponent(NavMeshAgent).Stop() when it detects a collision with another navmeshagent gameObject collider.
http://docs.unity3d.com/ScriptReference/NavMeshAgent.Stop.html
This seems to work a LITTLE better, but they still climb on top of each other to avoid each other. EDIT: Just realized this doesn't work at all, because I'm not using navmeshes. I'm using the AStar pathfinding project's components.
Answer by alvarosaavedra · Jan 14, 2016 at 04:39 PM
Hi @dubstaphone,
I have the same issue, did you solve it? I've been trying changing Rigidbody values (Mass, Drag, Angular Drag) but nothing. I hope you can help me somehow.
Thank you!
Answer by HotActionGames · Dec 14, 2016 at 03:58 AM
Unity is very poor in this regard, best to get rid of physics interactions between moving objects altogether and do your own, you can try all things everyone suggests and believe me, nothing will work, you should just use Triggers and Raycasts and put them on layers that don't react to each other on the built in physics
ps if you change Step Offset to 0 that will stop it but then the character won't climb anything!
Answer by smoki99 · Jan 09, 2017 at 06:30 AM
For me worked to lower the "Slope Limit" stopping the "character Controllers" to climb on each other.
Sometimes you also have to increase the "Capsule Collider".
Your answer
Follow this Question
Related Questions
Moving Enemy Along A Star Path 1 Answer
A* Pathfinding and keep the enmy at range 0 Answers