- Home /
Disabling collisions between Nav Mesh Agents?
Is there a way to disable collisions between two NavMeshAgents? They appear to push each other around, regardless of what Layer I put them on (so as to disable collision in the Physics Manager).
Just came across this same issue myself. I'm hoping that there is a simple fix, but it seems strange that disabling the collision layer matrix doesn't work. Is this a bug?
$$anonymous$$y Question TOO, O$$anonymous$$G, UNITY HELP!
Last time someone posted on this..Aug26th..Feb 2015 still no way to do this lol...
Answer by tanoshimi · Jan 01, 2014 at 07:32 AM
It seems that the inbuilt navmesh navigation system is broken with regards to ignoring/avoiding specific collisions, as evidenced by the responses (or lack of responses) to the following:
http://answers.unity3d.com/questions/258245/can-navmeshagent-avoid-other-agent.html
http://answers.unity3d.com/questions/496659/navmesh-agent-obstacle-avoidance-ignore.html
http://forum.unity3d.com/threads/199701-Navmesh-Agent-pass-through
http://forum.unity3d.com/threads/157287-navmesh-Obstacles-broken
It seems the only method to ignore collisions between two navmesh agents is to set both of their "Obstacle Avoidance Types" to "None" (suggested by Jakob@Unity here), but that of course ignores collisions with any dynamic obstacle... :(
Answer by WilliamBerne · Jul 24, 2013 at 07:46 AM
simply scale the radius of the NavMeshAgent to a very small number, like 0.1.
Your answer should be the one accepted.
Don't forget to use Nav$$anonymous$$eshSurface - was introduced in 2017, by Unity $$anonymous$$m. The trick is to bake several surfaces for various agents (there is now an additional "Agents" tab in Navigation window). In there, you could assign 'fake' radius to each such an agent, say 1.6, etc, but in reality make each nav$$anonymous$$eshAgent's prefab have something like 0.0001 radius.
This will ensure the agents with tiny radii do not walk too close to the walls. Also, a little more info about Nav$$anonymous$$eshSurface sampling: https://forum.unity.com/threads/solved-navmeshsurface-bug-or-feature-sampleposition.499069/#post-3245886
Also, you might encounter issues when radius is very small (0.00001). It's the best value to use, however unity will complain that agent wasn't placed on the Nav$$anonymous$$esh. To solve this, first allow character to reach the surface, and build the first nav-path. Once it did this, you can set the radius to 0.00001 because character is guaranteed to be on the surface.
To any future readers: this is the correct answer. Careful not to set the agent radius too low; the agents stop working.