motion
The pure maths of every platform: vectors and quaternions, path and ping-pong poses with waits and easing, triggered runs, stepped rotation, beat on/off state, crumble and fall phases, the elevator's call queue (deterministic, whatever order calls arrive in), seesaw and rope-swin…
motion
The pure maths of every platform: vectors and quaternions, path and ping-pong poses with waits and easing, triggered runs, stepped rotation, beat on/off state, crumble and fall phases, the elevator's call queue (deterministic, whatever order calls arrive in), seesaw and rope-swing steps, and launch speed for a jump height. Every function takes settings and a time and returns a pose, so every machine asking for the same time gets the same answer. Used by the Platform component and the tests.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2platformsKit.motion: the pure maths of every platform. Each function takes settings and a time on the shared clock and returns a pose, so every machine that asks for the same time gets the same answer. No entities, no state.
v(x: number, y: number, z: number) → any
| arg | type | description |
|---|---|---|
| x | number | |
| y | number | |
| z | number |
vec(p: any) → any
| arg | type | description |
|---|---|---|
| p | any |
quat(q: any) → any
| arg | type | description |
|---|---|---|
| q | any |
qmul(a: any, b: any) → any
| arg | type | description |
|---|---|---|
| a | any | |
| b | any |
qconj(q: any) → any
| arg | type | description |
|---|---|---|
| q | any |
qaxis(ax: number, ay: number, az: number, deg: number) → any
Rotation of `deg` degrees about an axis.
| arg | type | description |
|---|---|---|
| ax | number | |
| ay | number | |
| az | number | |
| deg | number |
qrot(q: any, v: any) → any
Rotate vector v by quaternion q.
| arg | type | description |
|---|---|---|
| q | any | |
| v | any |
qarr(q: any) → void
| arg | type | description |
|---|---|---|
| q | any |
add(a: any, b: any) → any return
| arg | type | description |
|---|---|---|
| a | any | |
| b | any |
sub(a: any, b: any) → any return
| arg | type | description |
|---|---|---|
| a | any | |
| b | any |
scale(a: any, k: number) → any return
| arg | type | description |
|---|---|---|
| a | any | |
| k | number |
mulv(a: any, b: any) → any return
| arg | type | description |
|---|---|---|
| a | any | |
| b | any |
len(a: any) → number return math
| arg | type | description |
|---|---|---|
| a | any |
lerp(a: any, b: any, t: number) → any
| arg | type | description |
|---|---|---|
| a | any | |
| b | any | |
| t | number |
compose(ppos: any, prot: any, pscale: any, lpos: any, lrot: any) → void
A world pose from a parent pose and a local pose: { pos, rot } with parent scale applied to the local position.
| arg | type | description |
|---|---|---|
| ppos | any | |
| prot | any | |
| pscale | any | |
| lpos | any | |
| lrot | any |
carryPoint(pt: any, p0: any, q0: any, p1: any, q1: any) → any
Where a point riding a moving frame goes when the frame moves from (p0, q0) to (p1, q1).
| arg | type | description |
|---|---|---|
| pt | any | |
| p0 | any | |
| q0 | any | |
| p1 | any | |
| q1 | any |
ease(u: number) → number
Ease in and out so a platform never jerks a rider at a stop.
| arg | type | description |
|---|---|---|
| u | number |
posmod(a: number, b: number) → number
| arg | type | description |
|---|---|---|
| a | number | |
| b | number |
stops(path: { any }?) → void
The stops a mover visits: its start {0,0,0} followed by every point of `path`.
| arg | type | description |
|---|---|---|
| path | { any }? |
legs(stops: { any }, speed: number, loop: boolean) → void
Legs of a run through stops (each { a, b, dur }) for a loop or a ping-pong.
| arg | type | description |
|---|---|---|
| stops | { any } | |
| speed | number | |
| loop | boolean |
cycle(stops: { any }, speed: number, wait: number, loop: boolean) → number
Seconds one full lap takes (loop) or one round trip (ping-pong), waits included.
| arg | type | description |
|---|---|---|
| stops | { any } | |
| speed | number | |
| wait | number | |
| loop | boolean |
pathPose(stops: { any }, speed: number, wait: number, loop: boolean, t: number) → any
Position along the stops at time `t` (seconds into the run; it repeats). `loop` true = round the stops and back to the start; false = to the end and back.
| arg | type | description |
|---|---|---|
| stops | { any } | |
| speed | number | |
| wait | number | |
| loop | boolean | |
| t | number |
triggeredPathPose(stops: { any }, speed: number, wait: number, loop: boolean, t0: number?, t: number) → void
One run that starts at `t0` (step or button trigger): the pose `t - t0` into it, resting at the start before and after.
| arg | type | description |
|---|---|---|
| stops | { any } | |
| speed | number | |
| wait | number | |
| loop | boolean | |
| t0 | number? | |
| t | number |
rotateAngle(axis: string, speed: number, wait: number, t: number) → number
Angle in degrees of a spinner at time t. With `wait` > 0 it turns in steps (90 degrees about y, 180 about x or z) and pauses `wait` seconds between them.
| arg | type | description |
|---|---|---|
| axis | string | |
| speed | number | |
| wait | number | |
| t | number |
rotatePose(axis: string, speed: number, wait: number, t: number) → any
| arg | type | description |
|---|---|---|
| axis | string | |
| speed | number | |
| wait | number | |
| t | number |
beatState(beat: number, onBeats: number, offBeats: number, offset: number, t: number) → void
Whether a beat block is there at time t, and whether it is about to go (the last half beat). Returns (on, warning, phase 0..1 through the whole on+off pattern).
| arg | type | description |
|---|---|---|
| beat | number | |
| onBeats | number | |
| offBeats | number | |
| offset | number | |
| t | number |
breakPhase(t0: number?, hold: number, respawn: number, t: number) → void
Phase of a crumbling or falling platform touched at `t0`: "idle" (whole), "shaking" (holding for `hold` s), "gone" (broken or falling), "back" (just returned, for a pop-in). Returns (phase, seconds into that phase).
| arg | type | description |
|---|---|---|
| t0 | number? | |
| hold | number | |
| respawn | number | |
| t | number |
breakBusy(t0: number?, hold: number, respawn: number, t: number) → boolean
Whether a touch at `t` starts a new break (it does unless one is already running).
| arg | type | description |
|---|---|---|
| t0 | number? | |
| hold | number | |
| respawn | number | |
| t | number |
fallDrop(e: number) → number
How far a falling platform has dropped `e` seconds after it let go (accelerating, capped).
| arg | type | description |
|---|---|---|
| e | number |
elevatorState(stops: { any }, speed: number, wait: number, base: any, calls: { any }, t: number) → any
Elevator state at time t. `base` = { floor, at } (resting at floor `floor` since `at`); `calls` = list of { floor, t } requests in any order. Calls are served in time order: a call made while it travels is queued and served after the current trip and its wait. Returns { pos, moving, floor (resting or last left), target, arrive }.
| arg | type | description |
|---|---|---|
| stops | { any } | |
| speed | number | |
| wait | number | |
| base | any | |
| calls | { any } | |
| t | number |
elevatorAuto(stops: { any }, speed: number, wait: number, t: number) → any
An always-running elevator: it visits every floor in turn, up and back down, waiting at each.
| arg | type | description |
|---|---|---|
| stops | { any } | |
| speed | number | |
| wait | number | |
| t | number |
seesawStep(angle: number, vel: number, target: number, stiff: number, dt: number) → void
One step of a seesaw: tilt angle (deg) and angular speed after `dt`, pulled toward `target` degrees by a damped spring. `stiff` scales how fast it responds.
| arg | type | description |
|---|---|---|
| angle | number | |
| vel | number | |
| target | number | |
| stiff | number | |
| dt | number |
seesawTarget(offsets: { number }, halfLength: number, maxTilt: number) → number
Target tilt of a seesaw from where its riders stand: each rider's distance from the pivot along the plank (metres, signed), the plank's half length, the max tilt (deg).
| arg | type | description |
|---|---|---|
| offsets | { number } | |
| halfLength | number | |
| maxTilt | number |
swingStep(theta: number, omega: number, r: number, g: number, push: number, pump: number, dt: number) → void
One step of a rope swing: angle (rad) and angular speed after `dt` for a pendulum of length `r` under gravity `g`, pumped by `push` (-1..1).
| arg | type | description |
|---|---|---|
| theta | number | |
| omega | number | |
| r | number | |
| g | number | |
| push | number | |
| pump | number | |
| dt | number |
launchSpeed(height: number, g: number) → number
Launch speed for a jump `height` metres high under gravity `g` (negative or positive).
| arg | type | description |
|---|---|---|
| height | number | |
| g | number |
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.