Interface RigidBodyProps

Hierarchy

Properties

activeCollisionTypes?: ActiveCollisionTypes

The default active collision types for all colliders in this rigid body. Can be customized per-collider.

Use ActiveCollisionTypes to specify which collision types should be active for this collider.

See

additionalSolverIterations?: number

Sets the number of additional solver iterations that will be run for this rigid-body and everything that interacts with it directly or indirectly through contacts or joints.

Compared to increasing the global World.numSolverIteration, setting this value lets you increase accuracy on only a subset of the scene, resulting in reduced performance loss.

angularDamping?: number

The angular damping coefficient of this rigid-body.

angularVelocity?: Vector3Tuple

The initial angular velocity of this body.

Default Value

[0,0,0]

args?: any

Arguments to pass to the collider

canSleep?: boolean

Whether or not this body can sleep.

Default Value

true

ccd?: boolean

Whether or not Continous Collision Detection is enabled for this rigid-body. https://rapier.rs/docs/user_guides/javascript/rigid_bodies#continuous-collision-detection

Default Value

false

children?: ReactNode

Automatically generate colliders based on meshes inside this rigid body.

You can change the default setting globally by setting the colliders prop on the component.

Setting this to false will disable automatic colliders.

collisionGroups?: number

The default collision groups bitmask for all colliders in this rigid body. Can be customized per-collider.

contactSkin?: number

The contact skin of the collider.

The contact skin acts as if the collider was enlarged with a skin of width contactSkin around it, keeping objects further apart when colliding.

A non-zero contact skin can increase performance, and in some cases, stability. However it creates a small gap between colliding object (equal to the sum of their skin). If the skin is sufficiently small, this might not be visually significant or can be hidden by the rendering assets.

Default Value

0

density?: number

Sets the uniform density of this collider. If this is set, other mass-properties like the angular inertia tensor are computed automatically from the collider's shape. Cannot be used at the same time as the mass or massProperties values. More info https://rapier.rs/docs/user_guides/javascript/colliders#mass-properties

dominanceGroup?: number

The dominance group of this RigidBody. If a rigid body has a higher domiance group, on collision it will be immune to forces originating from the other bodies. https://rapier.rs/docs/user_guides/javascript/rigid_bodies#dominance Default: 0

enabledRotations?: Boolean3Tuple

Allow rotation of this rigid-body only along specific axes.

enabledTranslations?: Boolean3Tuple

Allow translation of this rigid-body only along specific axes.

friction?: number

Set the friction of auto-generated colliders. This does not affect any non-automatic child collider-components.

frictionCombineRule?: CoefficientCombineRule
gravityScale?: number

The scaling factor applied to the gravity affecting the rigid-body.

Default Value

1.0

includeInvisible?: boolean

Include invisible objects on the collider creation estimation.

linearDamping?: number

The linear damping coefficient of this rigid-body.

linearVelocity?: Vector3Tuple

The initial linear velocity of this body.

Default Value

[0,0,0]

lockRotations?: boolean

Locks all rotations that would have resulted from forces on the created rigid-body.

lockTranslations?: boolean

Locks all translations that would have resulted from forces on the created rigid-body.

mass?: number

The mass of this collider. Generally, it's not recommended to adjust the mass properties as it could lead to unexpected behaviors. Cannot be used at the same time as the density or massProperties values. More info https://rapier.rs/docs/user_guides/javascript/colliders#mass-properties

massProperties?: {
    angularInertiaLocalFrame: Rotation;
    centerOfMass: Vector;
    mass: number;
    principalAngularInertia: Vector;
}

The mass properties of this rigid body. Cannot be used at the same time as the density or mass values.

Type declaration

  • angularInertiaLocalFrame: Rotation
  • centerOfMass: Vector
  • mass: number
  • principalAngularInertia: Vector
name?: string

The optional name passed to THREE's Object3D

onCollisionEnter?: CollisionEnterHandler

Callback when this collider collideas with another collider.

onCollisionExit?: CollisionExitHandler

Callback when this collider stops colliding with another collider.

onContactForce?: ContactForceHandler

Callback when this, or another collider triggers a contact force event

onIntersectionEnter?: IntersectionEnterHandler

Callback when this collider, or another collider starts intersecting, and at least one of them is a sensor.

onIntersectionExit?: IntersectionExitHandler

Callback when this, or another collider stops intersecting, and at least one of them is a sensor.

position?: Vector3

Initial position of the RigidBody

principalAngularInertia?: Vector3Tuple

Principal angular inertia of this rigid body

quaternion?: Quaternion

The rotation, as a Quaternion, of this collider relative to the rigid body

restitution?: number

Set the restitution (bounciness) of auto-generated colliders. This does not affect any non-automatic child collider-components.

restitutionCombineRule?: CoefficientCombineRule
rotation?: Euler

Initial rotation of the RigidBody

scale?: Vector3

The scale of this collider relative to the rigid body

sensor?: boolean

Sets whether or not this collider is a sensor.

The shape of your collider

softCcdPrediction?: number

The maximum prediction distance Soft Continuous Collision-Detection.

When set to 0, soft-CCD is disabled.

Soft-CCD helps prevent tunneling especially of slow-but-thin to moderately fast objects. The soft CCD prediction distance indicates how far in the object’s path the CCD algorithm is allowed to inspect. Large values can impact performance badly by increasing the work needed from the broad-phase.

It is a generally cheaper variant of regular CCD since it relies on predictive constraints instead of shape-cast and substeps.

Default Value

0

solverGroups?: number

The default solver groups bitmask for all colliders in this rigid body. Can be customized per-collider.

Specify the type of this rigid body

userData?: Record<string, any>

Passed down to the object3d representing this collider.

Methods

Generated using TypeDoc