Reputation: 1827
I'm looking for a way of setting up my humanoid NavMeshAgents to walk through each other.
I don't want them to collide with one another as there will be several players in the map and they'll need to just be able to ignore one another.
They should still be able to avoid the baked NavMesh obstacles but just ignore each other.
Upvotes: 2
Views: 2560
Reputation: 11
many years later, but I ran into the same problem and found a solution.
public NavMeshAgent agent;
agent.obstacleAvoidanceType = ObstacleAvoidanceType.NoObstacleAvoidance;
You can read more about it in the unity docs article here: https://docs.unity3d.com/ScriptReference/AI.NavMeshAgent-obstacleAvoidanceType.html
Currently using Unity Version 2022.3.24f1
Hope this helps!
Upvotes: 1
Reputation: 1338
So I just ran into this exact problem. Googling found older or very complicated solutions. I finally found an option under NavMeshAgent --> Obstacle Avoidance --> Radius. The trick in my situation was to set the radius to something very, very tiny; relative to the actual size of the GameObject. Then the objects can pass right by (thru) each other.
Upvotes: 2
Reputation: 1074
You should take a look at Unity's Layer-based collision detection. You'll need to set your non-colliding humans' layers to the same layer and then uncheck the box where it meets.
Upvotes: -1