Author Topic: Can I use this to fill in gaps and adjust the default Navmesh?  (Read 1261 times)

Offline MostHated

  • Member
  • *
  • Posts: 1
    • View Profile
Can I use this to fill in gaps and adjust the default Navmesh?
« on: January 26, 2018, 02:40:10 am »
Hey there, I got this last week and only messed around with it a little so far, but I noticed when I went to use it, it creates a new Navmesh seemingly not related to my existing one. Is it possible to use this to modify or adjust the default one? My ground space is quite large (game is an RPG) with a lot of open space. The default Navmesh generates well over the majority of the playspace, but has trouble sometimes when I get into town, or around structures and I was hoping that this would be able to supplement what the default Navmesh is not quite able to handle in the way I was wanting. Is this possible?

Offline Baroni

  • Administrator
  • *****
  • Posts: 1364
    • View Profile
Re: Can I use this to fill in gaps and adjust the default Navmesh?
« Reply #1 on: January 26, 2018, 10:24:53 am »
Hi,

[...] but I noticed when I went to use it, it creates a new Navmesh seemingly not related to my existing one. Is it possible to use this to modify or adjust the default one?

there are two different approaches combined in your question: modify and adjust.

Modify - using Unity's NavMesh components & API, you are already able to edit existing NavMesh data, by updating existing vertices and triangle indices of a NavMesh. Below are the corresponding scripting reference links:

https://docs.unity3d.com/ScriptReference/AI.NavMeshBuilder.UpdateNavMeshData.html
https://docs.unity3d.com/ScriptReference/AI.NavMeshTriangulation.html

Adjust - several components are available for that, for example placing new NavMesh Surfaces or excluding parts with NavMesh Modifiers.

https://docs.unity3d.com/Manual/class-NavMeshSurface.html
https://docs.unity3d.com/Manual/class-NavMeshModifier.html

In addition to that, our NavMesh Extension asset lets you create custom meshes visually, so you don't have to rely only on primitive types like planes, boxes or spheres. This means that you can draw a part that should be inaccessible and slap a NavMesh Modifier component on it. Or, keep the NavMesh Surface component with the default area type to extend an existing NavMesh with your custom shape and hit the Bake button.

It is correct that each mesh created with NavMesh Extension is a separate NavMesh Surface, however after baking, they are all combined into the same NavMesh provided that their area type is the same.