Skip to content

pathFollowing

pathFollowing(pos, vel, path, maxSpeed, predictDistance): Vec2

Defined in: src/modules/steering/steering.ts:332

Reynolds path following: predict where the agent is heading, and if that point strays outside the path corridor (path.radius), seek back toward a target nudged forward along the nearest segment. Returns the zero vector while the agent stays within the corridor. Stateless — it re-derives the nearest segment each call, so no waypoint index is threaded through.

Keeps the agent on the path; it does not stop at the final point. Compose with arrive for the last-leg approach.

Vec2

Vec2

Path

number

number

Vec2