Search Unity

  1. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  2. Unity 2017.1 is now released.
    Dismiss Notice
  3. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  4. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  5. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice

"Carve" option for nav mesh modifiers?

Discussion in 'Navigation' started by christougher, Sep 8, 2017.

  1. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    238
    Any plans to add an option to allow nav mesh modifiers to update the nav mesh at run time similar to the nav mesh obstacle "carve" option?

    Or what would be the lowest cost way to update the nav Mesh at run time like every frame or every x number of frames? I have fast moving objects that I want agents to react to. I have them set as obstacles right now set to constantly carve but it's messing with my collisions. The collisions worked fine in 5.6 but updating to 2017.1 jacked it up. I'm trying to do a reliable repro project for a bug report...
     
  2. DwinTeimlon

    DwinTeimlon

    Joined:
    Feb 25, 2016
    Posts:
    86
    Fast moving objects should use NavMeshObstacles imo, baking the navmesh every frame won't be fast enough if you have a bigger terrain/level. Could you go more in detail (or post a gif) about your collision problems? I have not yet run into any problems regarding the NavMeshObstacles.

    You could also try the newest 2017.2beta10 or 11, they have made significant improvements on the navmesh rebaking performance, but I am not sure if this is just for travel costs changes or the whole rebaking as I have tested only travel cost changes.
     
  3. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    238
    Thx! In your experience, what's the most performant way to update the travel cost changes with the navmeshSurface?
     
  4. DwinTeimlon

    DwinTeimlon

    Joined:
    Feb 25, 2016
    Posts:
    86
    For travel cost changes I would suggest using the LocalNavMeshBuilder instead of the NavMeshSurface. Just look at the code for the NavMeshSurface, it's really not optimized for frequent rebakes in runtime.

    If you really want to optimize it, I would actually suggest writing your own LocalNavMeshBuilder as I did. You can do some optimizations like collecting sources in a coroutine or collect only travel cost changes and cache all the other data, if it is static etc.