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).
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:
- Can Navmeshagent avoid other agent? - Questions & Answers - Unity Discussions
- 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…
Scale the radius
of the NavMeshAgent
to a very small number, like 0.1
.
To any future readers: this is the correct answer. Careful not to set the agent radius too low; the agents stop working.
– DripdryIt 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:
- Can Navmeshagent avoid other agent? - Questions & Answers - Unity Discussions
- 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…
Solution 1:
There’s the aforementioned method of setting the radius
of the NavMeshAgent
to 0.1
.
Solution 2:
When 2 NavMeshAgent collide during the time they are moving toward their destination, the NavMeshAgent with the lowest priority value will push the one with the highest value. (I know, it’s the reverse of its meaning.) If you want the only the stronger character (or vehicle) to move the weaker/lighter character (or vehicle), you can just set different priority value to each NavMeshAgent
.
Solution 3:
If you’re building a game where you want any colliding NavMeshAgent
to halt when they are close to be colliding, the simplest solution is to set the priority of the NavMeshAgent
of anything else than the local player to a lower priority as explained in the Solution 2, but then have those which has lower priority (which could push) to detect anything close by that could stop them and, whenever it happens, have their destination temporary set to their own position (so that they stop moving). For example, the player has higher priority (which would allows the AI to push the player), but the AI has a sphere or box collider set as trigger that, whenever a player enters it, the AI set its NavMeshAgent
destination to its own transform position and when the player exit it, set it back to the previous destination. The player would still be able to control its NavMeshAgent
, but wouldn’t be able to push the AI while the AI would just stop when close to the player instead of pushing it. You could also set some AI behavior so that whenever an AI enter another AI’s collider, their destination becomes one further away from the other collider’s source (in other words, moving away from the colliders)
Nav Mesh Agent
component->Obstacle Avoidance
→ Quality
→ None
It removes the collision between all the Nav mesh agent against each other. And follow the path as it is . I think this should work.
© 2022 - 2025 — McMap. All rights reserved.
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?
– NarthexLast time someone posted on this..Aug26th..Feb 2015 still no way to do this lol...
– IlexMy Question TOO, OMG, UNITY HELP!
– AirglowI have the same question! anyone know?
– Protoplast