@threlte/rapier

<AutoColliders>

The <AutoColliders> component generates colliders based on its children. Currently these shapes are available:

  1. cuboid – uses each child mesh bounding box and generates a cuboid collider
  2. ball – uses each child mesh bounding box and generates a ball collider
  3. capsule – uses each child mesh bounding box and generates a capsule collider
  4. trimesh – uses each child mesh geometry and generates a polygonal collider which resembles the geometry
  5. convexHull – uses each child mesh geometry and generates a collider which resembles a convex hull around the geometry

The resulting colliders can be transformed (i.e. positioned, rotated and scaled) as well as given regular collider properties such as mass or centerOfMass.

Model: Battle Damaged Sci-fi Helmet by theblueturtle_

Component Signature

If a <AutoColliders> component is not a child of a <RigidBody> component, the transform properties are reactive.

If you don't provide any of the properties density, mass or massProperties, Rapier will figure that out for you.

You can provide either a property density, mass or massProperties.

Props

name
type
required
default

contactForceEventThreshold
number
no

density
number
no

friction
number
no

frictionCombineRule
CoefficientCombineRule
no

mass
number
no

massProperties
{ mass: number, centerOfMass: Position, principalAngularInertia: Position, angularInertiaLocalFrame: Rotation, }
no

restitution
number
no

restitutionCombineRule
CoefficientCombineRule
no

sensor
boolean
no

shape
'cuboid' | 'ball' | 'capsule' | 'trimesh' | 'convexHull'
no
'convexHull'

Events

name
payload

create
{ ref: Collider[], cleanup: (callback: () => void) => 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

colliders
Collider[]