- Home /
making Navmesh Agents able to walk through each other?
im needing the Agents to not only ignore each other, but to walk through each other without altering each other's transform. a good example would be something like an mmo. everyone can walk through everyone including NPCs. i've tried making the radius very small, while putting obstacle avoidance to none, but that doesnt seem to do what i am looking for. in fact it still rotates and moves my NPCs when trying to walk through them.
Q1: Is there a way to do this without digging through the NavMeshAgent code?
Q2: if no to Q1, is there a way to change the NavmeshAgent code without purchasing the Unity Source Code? (ive not found any files for it as of yet)
Bump.
i don't know how to achieve this, but i suggest you to take a look at this , this may help.
ive come across that, however it only seems to be for the Navmesh it's self. not having anything to do with how the agent acts with other obstacles or agents let alone collision of said objects.
Answer by IgorAherne · Feb 03, 2018 at 12:15 AM
Indeed, set the radius of each NavMeshAgent's (in your prefabs) to a very small number
Don't forget to use NavMeshSurface - was introduced in 2017, by Unity team. 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 navMeshAgent'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 NavMeshSurface 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 NavMesh. 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.
Answer by MikeTheMonster · Sep 06, 2019 at 12:19 PM
Set obstacle avoidance quality of the agent to none.
I had hordes of enemies follow a pathfinder gameObject.
The pathfinder would often get stuck in the horde if the enemies clogged a hallway and needed to turn around.
Setting the radius of the zombies' avoidance smaller than their colliders did allow the pathfinder to move by them, but this also caused the horde to become too dense for the player to run through.
Your answer
Follow this Question
Related Questions
Why does my player object decide to ignore colliders whenever he feels like it? c# 1 Answer
How to detect if collisions are being ignored unity 2018 2 Answers
Instantiated Projectile IgnoreCollision Error 0 Answers
Ignore individual collisions between two objects 1 Answer
Ignoring collision on a specific parent or a tagged object 1 Answer