Documentation
    Preparing search index...

    Interface RigidBodyDescriptor

    How a body is created in a solver (§37 createBody), carrying §23's state plus the initial pose.

    Every field except RigidBodyDescriptor.type is optional; an omitted field means "the solver's own default", which for the §23 properties is the neutral value (zero velocity, zero damping, unit gravity scale, mass derived from collider density per §23/§25).

    type is deliberately required. §22's four body types are semantically distinct in a way no default can guess, and §23 makes the body type the sole expression of "does not simulate" — so leaving it out would silently pick a simulation model for the caller (decision, WP-5.1).

    interface RigidBodyDescriptor {
        angularDamping?: number;
        angularVelocity?: AngularVelocityInput;
        ccdMode?: CCDMode;
        ccdPredictionDistance?: number;
        centerOfMass?: Vector3Input;
        continuousCollisionDetection?: boolean;
        gravityScale?: number;
        inertiaTensor?: Matrix3;
        linearDamping?: number;
        linearVelocity?: Vector3Input;
        mass?: number;
        position?: Vector3Input;
        rotation?: RotationInput;
        space?: SpaceMode;
        type: BodyType;
    }
    Index
    angularDamping?: number

    Angular damping coefficient (§23). Must be finite and >= 0.

    angularVelocity?: AngularVelocityInput

    Initial angular velocity in radians per second (§23). A number is the scalar rate about +Z — the only angular freedom a "2d" world has.

    ccdMode?: CCDMode

    Which CCD method to use when it is on (§31).

    §23 carries the boolean switch and §31 the mode; they are reconciled as follows, and validateRigidBodyDescriptor enforces it:

    • neither given → "disabled" (Appendix A);
    • continuousCollisionDetection: true, no mode → DEFAULT_ENABLED_CCD_MODE ("swept");
    • a mode other than "disabled" given, no boolean → that mode, on;
    • continuousCollisionDetection: false and a non-"disabled" mode → a contradiction, rejected rather than silently resolved.
    ccdPredictionDistance?: number

    Prediction distance for "speculative" CCD, in world units (§31).

    How far ahead of the body speculative contacts are generated. Larger catches faster or thinner tunnelling cases at more broad-phase cost. Omitted means the adapter's documented default (1 on both Rapier adapters — the WP-5.4 pinned constant this field was recorded to replace; field added 2026-08-04). Only meaningful when the resolved CCD mode is "speculative"; giving it alongside any other resolved mode is a contradiction and is rejected (§85), exactly as the switch/mode contradiction above is.

    A positive finite number.

    centerOfMass?: Vector3Input

    Centre of mass in the body's local frame (§23). Defaults to the origin.

    continuousCollisionDetection?: boolean

    Whether continuous collision detection is on for this body (§23, §31). Defaults to false (Appendix A).

    gravityScale?: number

    Multiplier on the world gravity applied to this body (§23). 1 leaves gravity as-is, 0 makes the body weightless, negative values invert it.

    inertiaTensor?: Matrix3

    Rotational inertia about the centre of mass (§23). In a "2d" world only the Z diagonal entry is used and the rest is ignored, per §23's last rule.

    linearDamping?: number

    Linear damping coefficient (§23). Must be finite and >= 0.

    linearVelocity?: Vector3Input

    Initial linear velocity in metres per second (§23).

    mass?: number

    Mass in kilograms (§23). Authoritative when present and overriding the density-derived value; must be positive on a dynamic body, and is ignored for static bodies. When omitted, mass is collider density times volume (§23, §24, §25).

    position?: Vector3Input

    Initial world position. Vector2 widens to z = 0; in a "2d" world a Vector3 must have z === 0 (§21).

    rotation?: RotationInput

    Initial world rotation. A number is radians about +Z (§7a); in a "2d" world a Quaternion must be a pure Z rotation (§21).

    space?: SpaceMode

    The §8 space this body is solved in. Omitted means DEFAULT_SPACE_MODE ("world"), which is the only value a solver ever sees (PH-12, 2026-08-09).

    §8's two sentences are "physics normally operates in world or local-plane space" and "screen-space UI should not automatically participate in physical simulation unless explicitly mapped to a simulation plane", so this field is where a body says which of §8's frames it means and PhysicsWorld.addBody is where every value it cannot honour is refused — see RigidBody.space for the two refusals and their different reasons.

    Adapters may ignore it, and that is not accepted-and-ignored: the world refuses anything but "world" before createBody is called, so an adapter can only ever be handed the one value it would have assumed. The field is on the descriptor rather than on the component alone because §79's document is derived from the descriptor — which is what stops the saved form and the authored form from drifting apart.

    type: BodyType

    Which §22 simulation model this body follows. Required; see above.