NavMeshBuildSourceShape

Hi,

What’s the difference between NavMeshBuildSourceShape.ModifierBox and NavMeshBuildSourceShape.Box?

Thank you!

If I’m understanding this correctly from documentation, a box is used as simple geometry the mesh can be built on, like when you place a cube in your scene and build a NavMesh on it. A modifierbox however is a volume used to change the surface area type of the navmesh, with this you can draw an area that has a different cost, like the built-in walkable, not-walkable, and jump areas.

@Yandalf thank you for the quick reply. However looking at NavMeshBuildSource.shape I can set the shape field to either NavMeshBuildSourceShape.Box or NavMeshBuildSourceShape.ModifierBox, NavMeshBuildSource.area = 1 (assuming 1 is non-walkable) and specify the size and position using NavMeshBuildSourceShape.size and NavMeshBuildSourceShape.transform.

I’m unsure if the documentation is lacking here or I’m missing something :frowning:

Writing this in case it helps someone. I’m not 100% if it’s accurate:
NavMeshBuildSourceShape.Box is to describe a box primitive. However it’s assumed to be an empty box (as opposed to a filled/solid box). So NavMesh will exist in the insides of the Box and also on the surface.

Now, NavMesh generation involves creating a voxel representation and checking which voxels are “walkable”. So NavMeshBuildSourceShape.ModifierBox override a chunk of these voxels as having a different cost. The chunk is defined by the size and position of the ModifierBox.

At least that’s what makes sense to me based on trying a couple of combinations. Hope it will be useful for someone :slight_smile: