Introduction
Navigation mesh provides an efficient way to generate a valid path in the environment. The advantage of using navigation mesh is that it can quickly determine the "walkable" area and planning a path through the area.
The following is an example of navigation mesh, the left image is the mesh of an environment and the right image shows the navigation mesh on top of the original model.
We can see that the navigation mesh defines the walkable area along stairs but exclude other areas with obstacles. Efficient path planning can be done on the navigation mesh ( instead of the original mesh ) to quickly find a valid path throughout the mesh.
SmartBody makes use of the Recast-Detour library (https://code.google.com/p/recastnavigation/) to build the navigation mesh and pathfinding.
Building Navigation Mesh
To create a navigation mesh in SmartBody, simply use the API call :
scene.createNavigationMesh(meshFileName)
Here meshFileName is the full path to the mesh file. Currently, it only supports .OBJ file as input mesh. We will add support for other mesh file format in future updates. Once the navigation mesh is built, it can be viewed in the Viewer by selecting View–>Navigation Mesh–>Show NaviMesh.
Pathfinding in Navigation Mesh
The character can be steered in the navigation mesh environment automatically. Inside Viewer, simply right-click on the target location, and a new path along the navigation mesh will be computed automatically to steer the character.