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
| Field | Script name | Kind | Default | What it does |
|---|---|---|---|---|
| Path | path | text | empty | Name of the node holding the Path; empty means the parent. |
| Progress | progress | number, at least 0 | 0 | How far along, in world units. |
| Speed | speed | number | 60 | How fast, in units per second. Negative walks backwards. |
| Rotate | rotate | checkbox | off | Whether to face along the curve. |
| Offset | offset | two numbers (x, y) | (0, 0) | How far the follower sits off the curve; it turns with the curve only when Rotate is on. |
| Playing | playing | checkbox | on | Whether it is moving. |
| At End | at_end | one of Stop, PingPong | Stop | What it does at the end of an open path: stop there, or turn round and walk back; a closed path goes round. |