Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Can NavMeshObstacles modify an area instead of removing the path altogether?

Discussion in 'Navigation' started by FeastSC2, Nov 10, 2019 at 11:20 AM.

  1. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    636
    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 at 12:11 PM
  2. DwinTeimlon

    DwinTeimlon

    Joined:
    Feb 25, 2016
    Posts:
    158
    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 at 3:20 PM
    FeastSC2 likes this.