Skip to content

The nav mesh

For creatorsAdd-on 2.2.2+

You bake the walk-in house’s nav mesh in Blender, add a window the zombies vault through, and let the player board up doors and windows while the game runs.

▶ Play the test scene: the controls of tutorial 21, plus:

  • B boards up the door or window you face. B again, next to a board, takes it down.
  • The zombies climb the stairs, and they vault in through the west window.

The nav mesh is every floor, stair tread and step a body can stand on, built from the collision you tagged in tutorial 23. It is its own geometry, kept in your .blend.

  1. Bake. Open the walk-in house and press Nav on the toolbar (or Properties ▸ World ▸ Simulacrum ▸ Nav Mesh ▸ Bake). A NavMesh object appears: the open ground as green rectangles, a quad for every walkable surface above it, and a line for every step between two surfaces. Show / Hide toggles it.

  2. Check the agent. The Nav Mesh panel’s Settings hold the body the nav mesh is built for: Height, Step, Radius and Slope. The defaults fit the hero and the horde (see Settings). Defaults puts them back. Bake again after a change.

  3. Add a window vault. Put an empty on the floor inside the west window and another on the ground outside it. Give both Add Component ▸ Navigation ▸ Nav Link, and give both the same nav.link name, such as window. Each end settles on the walkable surface nearest it. Bake.

  4. Fence off a no-go zone. Add a box mesh over a spot the horde should avoid and give it Add Component ▸ Navigation ▸ Nav Null Area. The zombies go round it. It is never drawn in the game.

  5. Let the player board up. The board is the scene’s place action, on B unless you bind input.place to another key. Nothing else to add.

  6. Press ▶ Play. Board up the front door: the zombies stay out. Take the board down and they come in. Board the door again, and they vault in through the window; board the window too, and the next wave stays outside.

You rarely bake by hand. Play and Build bake by themselves when the collision has changed since the last bake, and reuse the bake when nothing has.

Edit the collision, not the NavMesh object. Every bake redraws the NavMesh object, and it is never exported or drawn in the game.

Component On What it does
Nav Link two empties sharing a nav.link name A way between them: a window to vault, a ladder, a drop. A zombie crosses on a straight run when that is the shorter way. Set nav.link.dir = out on an end to make the link one-way from it, or in to make it one-way to it
Nav Null Area a box mesh No nav inside: the horde goes round. Never drawn
Nav Bounds a box mesh Upper floors are built only inside it; the ground stays everywhere. Never drawn

A board across a link’s run closes it: a boarded window stops the vaulting.

  • A board is 1.6 × 2.2 m and goes up a metre in front of the hero.
  • The hero can’t walk through it, and the horde’s routes close behind it. Even a thin board seals a doorway.
  • B next to a board takes it down, and the way opens again.
  • You can have four boards up at once.

While Blender’s Play runs, edit a collision mesh and the game rebuilds the hero’s walls and the horde’s nav round it, where it was and where it is now.

The agent, in the Nav Mesh panel:

Field Tag Default Why
Height nav.height 1.7 m A zombie’s height: the headroom a surface needs
Step nav.step 0.45 m The hero climbs 0.45 m, so the horde follows wherever the hero steps
Slope nav.slope 60° The hero needs 60° to take a doorstep
Radius nav.radius half a cell How far bodies keep from walls. A gap narrower than twice this is closed

The cell size is the horde’s horde.cell (0.5 m with walk-in buildings).

Tag Values What it does
nav.link a name On two empties: the pair it belongs to
nav.link.dir both, out or in On one end: which way the link runs
input.place a key binding, default keys:KeyB The key that puts up and takes down a board
horde.nav set by the bake The baked nav mesh the game loads

Next: nav areas, where the ground slows bodies down and planners weigh what each step costs.