Build a HeightMesh for Accurate Character Placement
Use a HeightMesh to place your character more accurately on walkable surfaces during navigation.
During navigation, the NavMesh Agent is constrained on the surface of the NavMesh. Since the NavMesh is an approximation of the walkable space, some features are evened out when the NavMesh is built. For example, stairs may appear as a slope in the NavMesh. If your game requires accurate placement of the agent, you can either add a HeightMesh to your NavMesh, or build a HeightMesh when you bake the NavMesh.
Note
It takes extra memory and runtime processing to build a HeightMesh, therefore, it will take longer to bake the NavMesh.
To add a HeightMesh to your NavMesh:
- Open your scene in the Editor.
- Select the scene geometry or GameObject that contains your NavMesh.
- In the Inspector, expand the NavMesh Surface component, if necessary.
- In the NavMesh Surface component, expand the Advanced section, then select Build Height Mesh.
- When you are finished, click Bake.
The NavMesh is generated and displayed as a blue overlay and the HeightMesh as a pink overlay.
To build a HeightMesh when you bake the NavMesh:
- Follow the instructions to Create a NavMesh.
- In the NavMesh Surface component, select Build Height Mesh.
- When you are finished, click Bake.
The NavMesh is generated and displayed as a blue overlay and the HeightMesh as a pink overlay.