Skip to content

Nav areas

For creatorsAdd-on 2.2.2+

You build an open yard with mud and a stream that slow everyone down, where mindless walkers wade straight in and smarter runners go round.

▶ Play the test scene: the controls of tutorial 21. You start in the east, and the horde comes from the west.

  • Mud lies across the middle. Everyone in it moves at 40 % and sinks 0.35 m, you included.
  • Walkers are mindless: they wade straight into the mud and slow down.
  • Runners think: to them the mud costs the time it takes, so they go round.
  • A stream runs from edge to edge at 70 % speed. There is no way round, so everyone wades it.

The nav mesh says where a body can stand. An area says two more things about a patch of it:

What it means Who it touches
What the ground does speed: a body’s pace inside, as a fraction (mud 0.4). sink: how deep a body is drawn (mud 0.35 m) Every body in it, the hero too
What it costs to plan cost: how dear a metre inside is to a zombie planning its route. enter: an extra cost, in metres, for stepping in Only route planning

The cost defaults to the time it takes: 1 ÷ speed. Mud at 0.4 costs a planner 2.5 metres for every metre, so a zombie that plans goes round whenever round is faster. Set cost yourself for something a planner avoids that isn’t about time, such as fire: a cost of 10, with 4 m to step in.

  1. Start from a horde scene with a baked nav mesh (tutorial 25): an open yard, horde.cell = 0.5, and spawn points in the west.

  2. Write the areas table. In Blender’s Text Editor, make data/nav_areas.json, and point the scene at it with nav.areas = data/nav_areas.json:

    { "format": 1, "title": "Nav areas", "rows": [
    { "id": "mud", "speed": 0.4, "sink": 0.35, "enter": 0, "color": "#8a5a2b" },
    { "id": "stream", "speed": 0.7, "sink": 0.25, "enter": 0, "color": "#3a8ac8" },
    { "id": "fire", "cost": 10, "enter": 4, "color": "#ff6a1a" }
    ] }
  3. Paint what players see. Add a flat box painted brown across the middle for the mud, and a blue one from edge to edge for the stream. These are only the look.

  4. Add the area volumes. Add a box mesh over the mud and give it Add Component ▸ Navigation ▸ Nav Area, with nav.area = mud. Add another over the stream with nav.area = stream. A flat box on the ground holds the ground; a box at a storey’s height holds that floor, not the street under it. The volumes are never drawn in the game.

  5. Use the table’s costs. Each volume takes its cost and enter from its row in the table. To give one volume values of its own, press + Cost or + Enter in its Components box.

  6. Give the walkers a mindless filter. In data/zombies.json, add an areas column to the walker row: "areas": "mud:1,stream:1". Walkers now plan mud and the stream as dry ground, so they wade in. The ground still slows them: a filter changes what a zombie thinks, not what the ground does.

  7. Bake. Press Nav. The NavMesh object draws each area in its table colour, and the Nav Mesh panel lists each area’s cells.

  8. Press ▶ Play. The walkers wade into the mud, slow and sunk to their knees. The runners split round it. Everyone wades the stream, and so do you.

  • The cheapest step. A zombie takes the step that costs least under its own filter, entering costs included.
  • No cutting corners past a dearer area. A crowd rounding a fire’s corner never brushes the fire.
  • Straight lines respect cost. A walker heads straight through the mud; a runner never does.
  • Speed and sink. Every body moves at its pace × the speed of the area it stands in, and eases down to the area’s depth.
  • Fire. Fire is not in the walkers’ filter, so even a mindless walker goes round a fire volume.

Move an area volume in Blender while Play runs, and it moves in the game.

The areas table’s columns:

Column What it is
id The area’s name: mud, stream, fire
speed A body’s pace inside, as a fraction (1 = dry ground)
sink Metres a body is drawn lower inside
cost Metres a planner counts for each metre inside. Default: 1 ÷ speed
enter Metres a planner adds for stepping in from another area
color Its colour on the NavMesh object
Tag Values What it does
nav.areas default data/nav_areas.json The areas table
nav.area an area id, or null On a box: the area inside it. null is the no-go zone of tutorial 25
nav.cost · nav.enter numbers On a volume: override its row’s cost and enter
areas (zombie table column) id:cost,… A zombie type’s filter: how it plans those areas. 1 plans an area as dry ground

Where volumes overlap, the dearest area holds the spot.

Next: versions, locks and releases.