api
The airMotor api: claim a CharacterController body, set its exact air velocity each frame, release it into a ballistic coast that keeps the momentum, and add impulses (launch pads, boost rings, slingshots). Called by grappling hooks, gliders and any other part that flies the play…
airMotor.api
The airMotor api: claim a CharacterController body, set its exact air velocity each frame, release it into a ballistic coast that keeps the momentum, and add impulses (launch pads, boost rings, slingshots). Called by grappling hooks, gliders and any other part that flies the player; see the package README for the full surface.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2strict
now( ) → number
controller(body: string) → any
| arg | type | description |
|---|---|---|
| body | string |
emit(st: State, ev: string, data: any) → void
| arg | type | description |
|---|---|---|
| st | State | |
| ev | string | |
| data | any |
localBody( ) → string
The body entity id of the local player on this peer (the entity carrying its CharacterController), or nil.
isLocal(body: string) → boolean
Is this body simulated on this peer (so the motor may drive it)?
| arg | type | description |
|---|---|---|
| body | string |
state(body: string) → State
The motor state for a body, made on first use. Adds the AirMotor component that drives it each frame.
| arg | type | description |
|---|---|---|
| body | string |
velocity(body: string) → vector
The body's current world velocity (the motor's own while it drives, the controller's otherwise).
| arg | type | description |
|---|---|---|
| body | string |
owner(body: string) → string
Who steers the body now ("coast" while it flies on kept momentum, nil when idle).
| arg | type | description |
|---|---|---|
| body | string |
mode(body: string) → Mode
"idle", "owned" or "coast".
| arg | type | description |
|---|---|---|
| body | string |
grounded(body: string) → boolean
Is the body standing on ground?
| arg | type | description |
|---|---|---|
| body | string |
saveStats(st: State, cc: any) → void
| arg | type | description |
|---|---|---|
| st | State | |
| cc | any |
restoreStats(st: State) → void
| arg | type | description |
|---|---|---|
| st | State |
claim(body: string, owner: string, priority: number?) → boolean
Take the body: `owner` steers it until it releases or a higher priority claims it. Returns false when a higher-priority owner holds it or the body is not this peer's.
| arg | type | description |
|---|---|---|
| body | string | The body entity id. |
| owner | string | A name for whoever steers ("grapple", "glider", ...). |
| priority | number? | Higher wins; an equal claim takes over. Default 1. |
holds(body: string, owner: string) → boolean
Does `owner` hold the body now?
| arg | type | description |
|---|---|---|
| body | string | |
| owner | string |
setVelocity(body: string, owner: string, v: vector) → void
Ask for the body's velocity this frame. Only the owner's write counts. The motor applies it before the controller moves.
| arg | type | description |
|---|---|---|
| body | string | |
| owner | string | |
| v | vector |
release(body: string, owner: string, opts: { coast: boolean?, velocity: vector? }?) → void
Let the body go. By default it coasts on the momentum it has (a fling); `{ coast = false }` hands it straight back to the controller. `{ velocity = v }` sets the release velocity.
| arg | type | description |
|---|---|---|
| body | string | |
| owner | string | |
| opts | { coast: boolean?, velocity: vector? }? |
impulse(body: string, dv: vector) → void
Add a velocity change to the body (launch pads, boost rings, slingshots, updraft gusts). An owner keeps steering with the new speed; an idle body starts coasting.
| arg | type | description |
|---|---|---|
| body | string | |
| dv | vector |
launch(body: string, v: vector) → void
Set the body's velocity outright and let it coast (a cannon, a catapult, a respawn that should stand still with `vector.zero`).
| arg | type | description |
|---|---|---|
| body | string | |
| v | vector |
reset(body: string) → void
Stop driving the body at once and give it back to the controller (respawns, teleports, cutscenes).
| arg | type | description |
|---|---|---|
| body | string |
setCoast(body: string, opts: { gravity: number?, drag: number?, steer: number? }) → void
Tune the coast: `gravity` scale (1 = the controller's own), `drag` per second, `steer` m/s² of stick steering.
| arg | type | description |
|---|---|---|
| body | string | |
| opts | { gravity: number?, drag: number?, steer: number? } |
on(body: string, fn: (string, any) → void
Listen to the body's motor: fn(event, data) with "claimed", "lost", "released", "impulse", "landed" (data.speed, data.airTime). Returns a function that stops listening.
| arg | type | description |
|---|---|---|
| body | string | |
| fn | (string, any |
stick(body: string) → vector
The player's stick, as a world-space flat direction scaled 0..1 (what the controller's input map asked for this frame).
| arg | type | description |
|---|---|---|
| body | string |
baseGravity(st: State, cc: any) → number
| arg | type | description |
|---|---|---|
| st | State | |
| cc | any |
_step(body: string, dt: number) → void
Internal: one frame. AirMotor calls it at executionOrder -105.
| arg | type | description |
|---|---|---|
| body | string | |
| dt | number |
cut(a: number, b: number) → number
| arg | type | description |
|---|---|---|
| a | number | |
| b | number |
Mode = "idle" | "owned" | "coast"State = {The airMotor api: claim the built-in CharacterController body, set its exact air velocity each frame, release it into a coast that keeps its momentum, add impulses and launches, and listen for landings.Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
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.