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 NavMeshObstacles modify an area instead of removing the path altogether?

Discussion in 'Navigation' started by FeastSC2, Nov 10, 2019.

  1. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    978
    I have some enemies that want to avoid the light and some others that can go in the light.

    In order to do this, I want to create/modify the areas of the navmesh at runtime on the spots where the lights are. My lights are spherical just like a sphere collider so using NavMeshObstacle I modify those areas>
    HOWEVER these these areas are completely removed from the navmesh instead of having their layer modified like I would like.

    Is there a way to modify layers of the navmesh at runtime based on a collider that moves on the navmesh?
     
    Last edited: Nov 10, 2019
  2. DwinTeimlon

    DwinTeimlon

    Joined:
    Feb 25, 2016
    Posts:
    300
    Yes, you can have use Navmeshmodifier Volumes and change their layer settings. Depending on the size of your Navmesh and on the frequency of layer changes, you might run into performance issues. Afaik the navmesh baking is using DOTs already, so it's expected to be really fast.
     
    Last edited: Nov 11, 2019
    FeastSC2 likes this.