Skip to content

Components

NavRegion

A rectangle of the world that can be walked, baked into a grid for pathfinding. An enemy or a patrol finds a route across it that a Nav Obstacle can block outright and a Nav Cost can only make pricier.

On this page

Add it

+ Add node → Nav Region creates a node with it already on. Already have a node for it? Add component → NavRegionComponent.

From a script

A script on the same node writes these fields by name. NavRegionComponent is the name to pass.

rgs
set_point("NavRegionComponent", "size", vec2(640.0, 360.0));
set_number("NavRegionComponent", "cell_size", 16.0);
set_flag("NavRegionComponent", "diagonals", true);
set_number("NavRegionComponent", "clearance", 0.0);

Fields

FieldScript nameKindDefaultWhat it does
Sizesizetwo numbers (x, y), at least 1(640, 360)Size of the walkable rectangle in world units.
Cell Sizecell_sizenumber, at least 116How big one navigation cell is, in world units.
Allow DiagonalsdiagonalscheckboxonWhether an agent may move diagonally.
Maskmasknumber-1Which collider layers block this region.
Clearanceclearancenumber, at least 00How far walkers keep from walls; half a walker's width keeps it off them, under half a cell keeps narrow corridors open.