The pack
path
function path(): Pack<{ path: PathApi }, PathTopics>
The path pack: walkers along any geometry shape (baked by arc length so speed is even), and follow to drive objects by them. Headless.
Types
PathApi
interface PathApi
game.path.
walker(shape: Shape, opts?: WalkOptions): Walker— A headless walker on a shape: the game readsx y angleand does what it likes with them.follow(h: Handle, shape: Shape, opts?: WalkOptions): Walker— Drivehalongshapeeach step until it ends or is stopped; the walker is returned and the object is moved (and rotated withalign). Scene-scoped; a secondfollowon the same object replaces the first.stop(h: Handle): void— Stop drivingh. Safe when it is not followed.walkerOf(h: Handle): Walker | null— The walker drivingh, or null.readonly count: number— Objects being driven.
PathTopics
interface PathTopics
Signals, once per step.
'path.end': { id: string }— A followed object reached the end of its path (loop 'none').'path.lap': { id: string; laps: number }— A followed object wrapped or turned (loop / yoyo).
Walker
interface Walker
A position moving along a curve. update(dt) advances it; follow calls that for you each step.
t: number— Progress along the curve, 0..1 by length (after the ease). Set it to jump.readonly x: number— Current x.readonly y: number— Current y.readonly angle: number— Direction of travel, degrees.readonly distance: number— World units travelled this pass.readonly length: number— The curve's length.readonly done: boolean— Finished (loop 'none' reached the end).readonly laps: number— Passes completed (loop or yoyo turns).readonly reversed: boolean— Moving backwards (yoyo's return leg).paused: boolean— Hold.speed: number— Live speed, units/s.update(dt: number): boolean— Advance bydtseconds. Returns true while moving.reset(): void— Back to the start (orat).
WalkOptions
interface WalkOptions
How a walker moves.
speed?: number— World units per second along the curve. Default 100.duration?: number— Or: seconds for the whole curve (overridesspeed).loop?: 'none' | 'loop' | 'yoyo'— What happens at the end: stop, wrap to the start, or turn back. Default 'none'.ease?: EaseName | EaseFn— An ease over each pass (bydurationor by length atspeed). Default linear.at?: number— Start this far along, 0..1. Default 0.relative?: boolean— The curve is relative to the walker's start point (its handle's position whenfollowbegins). Default false: world coordinates.align?: boolean— Set the followed object's rotation to the direction of travel (+alignOffsetdegrees). Default false.alignOffset?: number— Degrees added when aligning. Default 0.samples?: number— Arc-length samples for the bake. Default 128 (more for long or wiggly curves).paused?: boolean— Start paused. Default false.


