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.
What you get
Section titled “What you get”- 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.
Two things an area is
Section titled “Two things an area is”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.
Build it
Section titled “Build it”-
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. -
Write the areas table. In Blender’s Text Editor, make
data/nav_areas.json, and point the scene at it withnav.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" }] } -
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.
-
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 withnav.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. -
Use the table’s costs. Each volume takes its
costandenterfrom its row in the table. To give one volume values of its own, press + Cost or + Enter in its Components box. -
Give the walkers a mindless filter. In
data/zombies.json, add anareascolumn 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. -
Bake. Press Nav. The NavMesh object draws each area in its table colour, and the Nav Mesh panel lists each area’s cells.
-
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.
How zombies use areas
Section titled “How zombies use areas”- 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.
Settings
Section titled “Settings”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.