Non-horizontal NavMeshes with multiple NavMeshSurfaces and NavMeshLinks
NavMeshes don’t have to be horizontal (or a slope close to horizontal). Let’s investigate this with NavMeshes on vertical walls and ceilings! We’ll also link different NavMeshes with NavMeshLinks, so our agents can travel through all NavMeshes in a scene.
Getting ready
This recipe adds to the previous one, so make a copy of that project folder and do your work for this recipe with that copy.
How to do it...
To work with non-horizontal NavMeshes, follow these steps:
- Add a new 3D cube to the scene, named
Cube-vertical
, at Position (0, 0, 16
) and Scale (12, 12, 12
). Check the Static option for this GameObject in the Inspector. - Move the position of the
Capsule-destination
GameObject to (0,10,15
). You should see the destination capsule floating above our new cube. - Select the
Terrain
in the Hierarchy, and click the Bake button for its Nav Mesh Surface component...