Creating a navigation mesh
Creating a navmesh utilizes all the fixed geometry within the sandbox. The C++ side of the navmesh generation takes care of representing the sandbox to the Recast library. Any SandboxObject
instance with a mass of zero, which is a fixed object, will be used for the navmesh generation.
Note
Planes are excluded from navmesh generation, so make sure that the ground is represented by a mesh or box.
We see a navigation mesh in the following screenshot:
Configuring navigation meshes
Generating a navmesh requires some basic information about the type of agents that will use pathfinding with the mesh. By default, the sandbox will autopopulate navmesh configuration, unless overriding values are provided during the generation.
Passing overrides to Recast happens through a Lua table. The properties shown in the following code snippet are the default values that are used when generating a navmesh without passing any override values to Sandbox.CreateNavigationMesh
:
local configuration...