Search Unity

What is the point of multiple NavMeshAgents... ...if they can only use a single NavMesh?

Discussion in 'Navigation' started by Ne0mega, Dec 18, 2018.

  1. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    755
    Maybe I am missing something.
    Right now I am primarily concerned with terrain grades (angles of inclination), as soldiers can go up steeper grades than vehicles.
    So I thought every navmeshagent would get its own navmesh.
    Does not appear to be the case.
    Can you still limit navmeshAgents by angle, running on the only single allowed navmesh?
     
  2. MrG

    MrG

    Joined:
    Oct 6, 2012
    Posts:
    368
    In the Navigation window, you have an Agents tab...there you'd set up values to match your smallest unit with greatest step height, and maximum slope that at least some of your units can cope with. That's for baking the NavMeshfor maximum accessibility. Then for your individual units (or prefabs) you'll give them a NavMeshAgent component where you'll generally set more restrictive values. When you call SetDestination for that unit, the NavMesh system will apply that unit's settings to restrict where on the NavMesh it can actually go, and plot a route accordingly.

    As a result, your people can fit through doors to go through a building but your battle tanks with much larger size settings will go around it.
     
    hertz-rat and hippocoder like this.
  3. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    755
    Thank you muchly. So maybe I don't actually need multiple navmeshes then.
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    That's not correct. You need one navmesh baked per agent type. The component for Agent has a radius that is only for agent to agent avoidance.

    For navigating different sizes, a navmesh must be baked for each.
     
  5. Ne0mega

    Ne0mega

    Joined:
    Feb 18, 2018
    Posts:
    755
    Schucks. :/

    But why do the navMeshAgents have settings like angle and step etc?
    I mean woudln't all the necessary information be stored in the navmesh they are assigned to?
    I mean why have the settings in the navmeshagent componenet, AND in the navMeshBake interface?