Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Can Obstacles only carve in one NavMeshAgent type?

Discussion in 'Navigation' started by Papiertig0r, Feb 19, 2019.

  1. Papiertig0r

    Papiertig0r

    Joined:
    Jun 27, 2014
    Posts:
    4
    Hey,

    I need an approach to having multiple agent types and moving obstacles that only are in the way of one agent type - is this possible?

    For now I tried adding multiple NavMeshSurfaces and attached NavMeshModifierVolumes to the obstacles, but recalculating the NavMeshSurface at runtime, but this isn't working as intended.

    I also need to know, if there is a complete path or the obstacles block it - and I need to check that quite frequently.
     
  2. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    Well, best I can find is to indeed use the ModifierVolumes and use the Affected Agents field to specify what agents can ignore these.
    Keep in mind you should remove the Obstacle components from these modifierVolumes. Obstacles cut out parts of the NavMesh, and those cuts automatically count for all agents.

    As for your second question, I believe NavMeshAgent.pathStatus does exactly what you want here.
     
  3. Papiertig0r

    Papiertig0r

    Joined:
    Jun 27, 2014
    Posts:
    4
    Thank you for you answer, but the path status is always partial with this method, never complete (even if the path is completely free) and never invalid (even if there are modifier volumes in the way cutting the surface completely in two halves :/