Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Simple question: How to make a mesh non - walkable

Discussion in 'Navigation' started by zedz, Jun 2, 2023.

  1. zedz

    zedz

    Joined:
    Aug 31, 2013
    Posts:
    244
    I asked a similar question before but perhaps it wasnt clear, here I've included a picture so it should make it more clear what I want to achieve

    From the OP in 'new Navigation package in town' thread
    I'm trying to do something that was very easy to do with the old package, thus since the new one has parity it should be achievable but I can't see how. I've searched online but no luck coming up with an answer.

    i.e. designate a mesh as non-walkable, like the rock in the middle here, I dont want the navmesh to be on it, but I still want the navmesh to go around it.

    I could use a navmesh obstacle which is messy and gives inferior results, as it doesnt use the meshes shape

    cheers


    EDIT: Actually heres a better example from unitys own tutorial.
    See video #2.
    The navmesh actually generates on top of the wall!!!, something you don't want, you want to walk around the walls not on top of them

    https://learn.unity.com/tutorial/runtime-navmesh-generation#5c7f8528edbc2a002053b492

    Im beginning to think maybe its not possible with the new navmesh system as easy as it was with the old system, its a pity as the new system seems to generate quicker and results in a better navmesh
     
    Last edited: Jun 4, 2023
  2. Inxentas

    Inxentas

    Joined:
    Jan 15, 2020
    Posts:
    275
    While it's true the obstacle doesn't use the rock's shape, you could still position one slightly above ground level so it doesn't affect the ground at all. All you want is the ara on top of the rock to not be included in the navmesh generation, right? As long as the NavMeshObstacle fully encloses the surface area you want to be unwalkable, it doesn't need to be the exact shape. With complex shapes you might need multiple NavMeshObstacles. I don't think your shape requires more then two flattened cubes with the "carve" option turned on.
     
  3. androvisuals_unity

    androvisuals_unity

    Joined:
    Mar 23, 2020
    Posts:
    47
    Maybe try using the NavMeshModifierVolume?

    Here I use it on top of a box to make sure that it's not walkable.

    upload_2023-7-5_15-33-2.png
     
  4. Papouth

    Papouth

    Joined:
    Mar 28, 2020
    Posts:
    8
    Add NavMesh Obstacle Component -> then tick "Carve"

    It will auto correct the NavMesh