@threlte/rapier

<RigidBody>

The real-time simulation of rigid bodies subjected to forces and contacts is the main feature of a physics engine for videogames, robotics, or animation. Rigid bodies are typically used to simulate the dynamics of non-deformable solids as well as to integrate the trajectory of solids which velocities are controlled by the user (e.g. moving platforms).

Note that rigid-bodies are only responsible for the dynamics and kinematics of the solid. Colliders can be attached to a rigid-body to specify its shape and enable collision-detection. A rigid-body without collider attached to it will not be affected by contacts (because there is no shape to compute contact against).

Component Signature

Props

name
type
required
default

angularDamping
number
no
0

angularVelocity
Rotation
no
{}

canSleep
boolean
no
true

ccd
boolean
no
false

dominance
number
no
0

enabledRotations
Boolean3Array
no
[true, true, true]

enabledTranslations
Boolean3Array
no
[true, true, true]

gravityScale
number
no
1

linearDamping
number
no
0

linearVelocity
Position
no
{}

lockRotations
boolean
no
false

lockTranslations
boolean
no
false

type
'fixed' | 'dynamic' | 'kinematicPosition' | 'kinematicVelocity'
no
'dynamic'

userData
Record<string, any>
no
{}

Events

name
payload

create
{ ref: RigidBody, cleanup: (callback: () => void) => void }

sleep
void

wake
void

collisionenter
{ targetCollider: Collider, targetRigidBody: RigidBody | null, manifold: TempContactManifold, flipped: boolean }

collisionexit
{ targetCollider: Collider, targetRigidBody: RigidBody | null }

sensorenter
{ targetCollider: Collider, targetRigidBody: RigidBody | null }

sensorexit
{ targetCollider: Collider, targetRigidBody: RigidBody | null }

contact
{ targetCollider: Collider, targetRigidBody: RigidBody | null, manifold: TempContactManifold, flipped: boolean, maxForceDirection: Vector, maxForceMagnitude: number, totalForce: Vector, totalForceMagnitude: number }

Bindings

name
type

rigidBody
RigidBody