dacha
    Preparing search index...

    Class RigidBody

    Makes an actor take part in physics. type decides what moves the body: the simulation or your code.

    Hierarchy (View Summary)

    Index
    actor?: Actor

    The actor that has this component. It is undefined until the component is added to an actor.

    angularDamping: number

    Angular damping used to slow down rotation over time

    angularVelocity: number

    Current angular velocity of the rigid body in radians per second

    disabled: boolean

    Whether rigid body simulation is disabled

    gravityScale: number

    Gravity multiplier. 0 ignores gravity, 1 uses normal world gravity.

    linearDamping: number

    Linear damping used to slow down movement over time

    linearVelocity: Vector

    Current linear velocity in world units per second

    lockRotation: boolean

    Whether dynamic rotation is locked. Locked bodies do not spin from torque or contacts.

    oneWay: boolean

    Whether contacts should only be resolved from one side

    oneWayNormal?: Vector

    Local-space normal that points toward the blocking side

    type: "dynamic" | "static" | "kinematic"

    Body type that defines how the rigid body participates in simulation

    • get friction(): number

      Surface friction used by contact resolution. Higher values reduce sliding more strongly.

      Returns number

    • set friction(value: number): void

      Surface friction used by contact resolution. Higher values reduce sliding more strongly.

      Parameters

      • value: number

      Returns void

    • get inertia(): number
      Advanced

      Moment of inertia used by dynamic bodies.

      Inertia is the rotational equivalent of mass: higher values make the body harder to spin. It is automatically computed from the collider shape, mass, and collider offset every physics step, so user code usually should only read this value.

      Returns number

    • set inertia(value: number): void
      Advanced

      Moment of inertia used by dynamic bodies.

      Inertia is the rotational equivalent of mass: higher values make the body harder to spin. It is automatically computed from the collider shape, mass, and collider offset every physics step, so user code usually should only read this value.

      Parameters

      • value: number

      Returns void

    • get inverseInertia(): number
      Advanced

      Returns the inverse moment of inertia.

      This is the solver-friendly form of inertia. Static bodies, kinematic bodies, locked rotation, or non-positive inertia return 0.

      Returns number

    • get inverseMass(): number
      Advanced

      Returns the inverse mass.

      Bodies with zero or negative mass return 0.

      Returns number

    • get mass(): number

      Sets the mass used by dynamic bodies.

      Mass is an authored, kilogram-like scalar. Non-positive values make the body immovable by forces and impulses.

      Returns number

    • set mass(value: number): void

      Sets the mass used by dynamic bodies.

      Mass is an authored, kilogram-like scalar. Non-positive values make the body immovable by forces and impulses.

      Parameters

      • value: number

      Returns void

    • get restitution(): number

      Bounciness used by contact resolution. 0 does not bounce, 1 keeps full bounce speed.

      Returns number

    • set restitution(value: number): void

      Bounciness used by contact resolution. 0 does not bounce, 1 keeps full bounce speed.

      Parameters

      • value: number

      Returns void

    • Adds an instantaneous angular impulse to a dynamic body for the next physics step.

      Angular impulse is an immediate rotational kick. Affects only active dynamic bodies with unlocked rotation.

      Parameters

      • impulse: number

      Returns void

    • Adds a continuous force to a dynamic body for the next physics step.

      Affects only active dynamic bodies. When position is provided, it is a world-space point where the force is applied; off-center forces can also rotate the body.

      Parameters

      Returns void

    • Adds an instantaneous impulse to a dynamic body for the next physics step.

      Affects only active dynamic bodies. An impulse is a one-step velocity kick. When position is provided, it is a world-space point where the impulse is applied; off-center impulses can also rotate the body.

      Parameters

      Returns void

    • Adds a continuous torque to a dynamic body for the next physics step.

      Torque is rotational force: it changes angular velocity over time. Affects only active dynamic bodies with unlocked rotation.

      Parameters

      • torque: number

      Returns void

    • Clears all accumulated force and impulse values.

      Returns void

    • Returns the component of the same class on the parent actor.

      Returns Component<object> | undefined

      The component, or undefined if the actor has no parent actor or the parent has no such component.

    • Moves a kinematic body to a target position on the next physics step.

      The physics system computes a one-step velocity from the current position to this target so contacts can react to the kinematic movement.

      Parameters

      Returns void