Reader small image

You're reading from  Learning Game AI Programming with Lua

Product typeBook
Published inNov 2014
Reading LevelBeginner
PublisherPackt
ISBN-139781783281336
Edition1st Edition
Languages
Right arrow
Author (1)
David Young
David Young
Right arrow

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...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Learning Game AI Programming with Lua
Published in: Nov 2014Publisher: PacktISBN-13: 9781783281336

Author (1)