Skip to content

Components

NavAgent

Walks this node to its Target by the cheapest way the Nav Region under it allows: round walls and obstacles, across links. A Character Body is moved by its velocity, so walls still hold; a node without one is moved directly.

On this page

Add it

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

From a script

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

rgs
set_point("NavAgentComponent", "target", vec2(0.0, 0.0));
set_flag("NavAgentComponent", "moving", false);
set_number("NavAgentComponent", "speed", 80.0);
set_number("NavAgentComponent", "arrive_distance", 4.0);
set_flag("NavAgentComponent", "face_walk", false);
set_flag("NavAgentComponent", "use_links", true);

Fields

FieldScript nameKindDefaultWhat it does
Targettargettwo numbers (x, y)(0, 0)Where it walks to, in the world.
MovingmovingcheckboxoffWhether it is walking to its Target now; it turns off when it arrives or finds no way there.
Speedspeednumber, at least 080How fast it walks, in world units a second.
Arrive Distancearrive_distancenumber, at least 0.54How near its Target counts as there.
Face Walkface_walkcheckboxoffMirrors this node's Sprite to face left while it walks left.
Use Linksuse_linkscheckboxonWhether its way may cross Nav Links: ladders, drops and teleports.