Skip to content

Components

PathFollow

Walks a Path, its parent's by default or one named here, at its own speed and place along it, so several followers can share one path. At the end of an open path it stops or turns back; its script hears each point it passes.

On this page

Add it

+ Add node → Path Follower creates a node with it already on. Already have a node for it? Add component → PathFollowComponent.

From a script

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

rgs
set_text("PathFollowComponent", "path", "");
set_number("PathFollowComponent", "progress", 0.0);
set_number("PathFollowComponent", "speed", 60.0);
set_flag("PathFollowComponent", "rotate", false);
set_point("PathFollowComponent", "offset", vec2(0.0, 0.0));
set_flag("PathFollowComponent", "playing", true);

Fields

FieldScript nameKindDefaultWhat it does
PathpathtextemptyName of the node holding the Path; empty means the parent.
Progressprogressnumber, at least 00How far along, in world units.
Speedspeednumber60How fast, in units per second. Negative walks backwards.
RotaterotatecheckboxoffWhether to face along the curve.
Offsetoffsettwo numbers (x, y)(0, 0)How far the follower sits off the curve; it turns with the curve only when Rotate is on.
PlayingplayingcheckboxonWhether it is moving.
At Endat_endone of Stop, PingPongStopWhat it does at the end of an open path: stop there, or turn round and walk back; a closed path goes round.