Documentation
    Preparing search index...

    Interface RigidBodyCommands

    What a body has been asked to do since the world last drained it (§26, §32).

    Read-only view of live, body-owned storage: the vectors and the pool entries are the body's own instances, so a reference taken here reflects later accumulation and is reset in place when the world clears the buffers. Nothing in this record is simulation state — it is a queue of requests.

    The world consumes the whole record once per fixed step, hands it to the adapter, and clears it. That single rule produces the two behaviours §26 describes:

    • a force or torque acts for one step only. To push continuously, call applyForce every step (from a fixedUpdate listener, §10) — the buffer is empty again by the time the next step begins;
    • an impulse is a one-shot change of momentum. Applying it once is enough, and the same clearing rule guarantees it is not applied twice.

    pointForces and pointImpulses are pools that grow to the high-water mark of a single step and never shrink; only the first pointForceCount / pointImpulseCount entries are live. Clearing resets the counts, not the arrays, so a steady-state body accumulating point loads every step allocates nothing (§7b, plan D7).

    interface RigidBodyCommands {
        angularImpulse: Vector3;
        force: Vector3;
        impulse: Vector3;
        pointForceCount: number;
        pointForces: readonly PointLoad[];
        pointImpulseCount: number;
        pointImpulses: readonly PointLoad[];
        sleepCommand: SleepCommand | null;
        torque: Vector3;
    }
    Index
    angularImpulse: Vector3

    Accumulated angular impulse in newton-metre-seconds (§26 applyAngularImpulse).

    force: Vector3

    Accumulated linear force in newtons (§26 applyForce).

    impulse: Vector3

    Accumulated linear impulse in newton-seconds (§26 applyImpulse).

    pointForceCount: number

    How many entries of RigidBodyCommands.pointForces are live.

    pointForces: readonly PointLoad[]

    Pooled applyForceAtPoint entries; see the record documentation.

    pointImpulseCount: number

    How many entries of RigidBodyCommands.pointImpulses are live.

    pointImpulses: readonly PointLoad[]

    Pooled applyImpulseAtPoint entries; see the record documentation.

    sleepCommand: SleepCommand | null

    The last RigidBody.wake or RigidBody.sleep of this step, or null.

    Last call wins rather than two independent flags: a body told to wake and then to sleep within one step has to resolve to something, and "the most recent instruction" is the only resolution that does not depend on the order in which the world happens to read two booleans (§33).

    torque: Vector3

    Accumulated torque in newton-metres (§26 applyTorque).