Skip to content

Components

NavCost

A rectangle that is walkable but costs more to cross than open ground: spikes an enemy crosses only when there is no other way, shallow water that slows a patrol. Not a wall — the search still takes it once the detour costs more.

On this page

Add it

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

From a script

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

rgs
set_point("NavCostComponent", "size", vec2(64.0, 64.0));
set_number("NavCostComponent", "cost", 3.0);
set_flag("NavCostComponent", "enabled", true);

Fields

FieldScript nameKindDefaultWhat it does
Sizesizetwo numbers (x, y), at least 1(64, 64)Size of the priced rectangle in world units.
Costcostnumber, at least 0.013How many times pricier this ground is than ordinary ground.
EnabledenabledcheckboxonWhether it is priced right now.