Search Unity

NavMeshSurface and the Not Walkable Setting

Discussion in 'Navigation' started by ElysianOne, Jan 19, 2018.

  1. ElysianOne

    ElysianOne

    Joined:
    Aug 16, 2017
    Posts:
    7
    upload_2018-1-19_20-27-18.png
    I've been experimenting with the Higher-level Navigation tools that Unity has provided recently, such as Nav Mesh Surfaces and NavMeshLinks, with the eventual intention of creating a system where I can bake a NavMesh at runtime. Above is a screenshot of my simple test map for this system so far, where I've baked the navigation mesh using a Nav Mesh Surface on my environment. However, there's a problem. I don't want the tops of the protruding cubes to be walkable surfaces, just obstacles that obstruct the nav mesh on the ground. I have all of the cubes set to "Non-walkable" in the navigation settings but I assume this is not the correct way to go about things as the Nav Mesh Surface seems to be completely ignoring me and baking a navmesh onto them anyway.
    Anyone know how to fix this? I assume I'm probably just missing something obvious...
    Many thanks.
     
  2. SM_AF

    SM_AF

    Joined:
    Aug 1, 2017
    Posts:
    23
    I am at work right now, so can't go deeper, but I might have something for you - try setting the NavMeshSurface's Default Area or the Include Layers settings. The layer mask should definitely work. Use something like a "Terrain" layer for the base plane you have there and the an "Obstacle" layer for the boxes.

    If you would not be using the NavMeshSurface, but the classic single NavMesh workflow accessible from the Navigation Window instead, then you could also tweak the combination of the Step Height and the Min Region Area settings to optimize the resulting NavMesh I believe (to get rid of the small, separated, useless areas like those on the boxes in your screenshot).
     
  3. danscoutible

    danscoutible

    Joined:
    Jan 27, 2016
    Posts:
    15
    Add the NavMashModifier component to your raised objects. Enable "Override Area" in the inspector, and select "Not Walkable." When you re-bake the NavMesh, the walkable areas on top should be gone.

    If for some reason that doesn't work in your case, you can alternatively use NavMeshModifierVolume and surround those areas with "Not Walkable" volumes.