Game Development Reference
In-Depth Information
Building the navigation mesh
Constructing a navigation mesh is an expensive operation that will halt the execution of the
sandbox till the mesh has been generated. Usually, the generation should happen during the
sandbox's initialization, but nothing prevents the navigation mesh from being regenerated
at any time.
Note
While the sandbox doesn't support serializing the navigation mesh and loading a previously
serialized navmesh by default, the underlying Recast library supports the storing and load-
ing of the binary navmesh data.
When creating a navmesh, we assign a name to the mesh; this allows any further manipula-
tion or querying of the mesh to be referenced by name.
Tip
As navmeshes are meant to be shared between similar AI agents, it's best to generate the
navmesh in the sandbox's initialization and reference the navmesh by name in each agent
script. Creating a navmesh with the same name as an existing navmesh will destroy the pre-
vious mesh.
Creating a navmesh is done through the CreateNavigationMesh function provided
by the sandbox.
function Sandbox_Initialize(sandbox)
Sandbox.CreateNavigationMesh(
sandbox, "default", configuration);
end
Search WWH ::




Custom Search