Search Unity

Make NavMeshAgents traverse each other

Discussion in 'Navigation' started by mapa17, Jun 18, 2019.

  1. mapa17

    mapa17

    Joined:
    Jan 27, 2019
    Posts:
    14
    Hi, I have multiple NavMeshAgents running around in my scene, and it happens that while navigating around they bump into each other and block each others ways.

    Is there an easy way to make them simple traverse each other? (Like ghosts) So that there is no colisión avoidance happening? I tried by reducing the Agents Radius to 0.05 (the minimum) but the agents still collide.

    Any ideas?
     
  2. ClaudiaTheDev

    ClaudiaTheDev

    Joined:
    Jan 28, 2018
    Posts:
    331
    Here are some ideas:

    Changing Priority:
    You could try to play with the setting Priority under Obstacle Avoidance. When it differes the agent with the lower number pushes the agent with the higer number away. It isnt traversing but perhaps it is enough for you.
    https://forum.unity.com/threads/official-way-to-make-agents-avoid-each-other.659446/

    Changing radius:
    Some topics say when you change the agent radius to a very small number it works.
    https://answers.unity.com/questions/486023/disabling-collisions-between-nav-mesh-agents.html

    Baking a nav mesh for each agent:
    Also then upper topic says something about baking the nav mesh for each different agents (last comment)
     
  3. mapa17

    mapa17

    Joined:
    Jan 27, 2019
    Posts:
    14
    Hello Gor-Sky,

    thank you for your reply!
    I have tried reducing there radius to its minimum (0.05) ant it helps a bit, but the collisions still exist.
    I don't want to go down assigning priorities, because the agents are all equal, and there still would be collisions happening.

    I hoped there would be a way to simply avoid the collision avoidance to run at all. So the Agents would only rely on the NavMesh planning.

    best,
    Manuel
     
  4. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    I don't think there's options to disable parts of the navigation unfortunately. I'm afraid you might have to roll your own. Maybe see if Aron Granberg's A* solution allows you to do so.
     
  5. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    What you want is supported it's just a bit of extra work. You do pathfinding queries but don't use the NavmeshAgent, move the transform yourself along the path.

    Vector3.MoveTowards combined with some acceleration/deceleration logic and rotation should do it. It's not really much code but it might take a bit of a learning curve if you haven't worked with lower level movement logic before.