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

Question Handling Static Navmesh Obstacles

Discussion in 'Navigation' started by JacobDecisionLab, Jan 9, 2023.

  1. JacobDecisionLab

    JacobDecisionLab

    Joined:
    Nov 16, 2022
    Posts:
    9
    For the current project I am working on we have a very large generated terrain area, with trees placed on top. Currently we have all the trees set as navmesh obstacles that carve out an area of the navmesh

    Because there are so many trees, navmesh carving is attributing to nearly half the processing time every frame in our model. Is there a way to make it so that Navmesh obstacles that are always static do not need to keep carving every frame?

    Or, if we only want to generate the navmesh because none of the obstacles move, is there a way to stop it updating so often and triggering it to carve again?
     
  2. androvisuals_unity

    androvisuals_unity

    Joined:
    Mar 23, 2020
    Posts:
    47
    You don't need to use navmesh obstacles for this. Just a simple collider will do.
    Just put a capsule or box collider for the tree trunk, give it a layer like "obstacle"
    Then in navmesh surface set it to use Physics colliders and set the include layers to include the physics layer "obstacle".
    You can use any name you'd like.
    I think you should only use carving if an object moves, like a platform that goes left or right.
    For static objects like trees this should work perfectly

    upload_2023-1-19_13-22-21.png

    upload_2023-1-19_13-24-23.png

    upload_2023-1-19_13-20-46.png
     
    Tete8008, Liam2349 and warthos3399 like this.
  3. jumisko

    jumisko

    Joined:
    Feb 18, 2020
    Posts:
    13
    The first method does not work with trees added using Terrain Tools trees. Is there a way to do that with AI Navigation yet?