Colliders
A collider gives a body its shape for the physics solver. Colliders are declared by the
collider schema (packages/engine/src/scene/schema/collider.ts).
Shapes
Section titled “Shapes”type | Sizing fields |
|---|---|
cuboid | halfExtents ([x, y, z] half-size) |
ball | radius |
capsule | radius + halfHeight |
trimesh | built from the entity’s mesh geometry |
Material properties
Section titled “Material properties”friction— surface friction coefficient.restitution— bounciness (0 = no bounce, 1 = perfect bounce).density— mass density; the body’s mass is computed from density × collider volume (unlessmassis set on the body).offset— translation of the collider relative to the body origin.
Sensors (trigger volumes)
Section titled “Sensors (trigger volumes)”Set isSensor: true to make a collider detect overlaps without physically blocking.
Sensors are how you build trigger zones (checkpoints, pickups, damage volumes) — they fire
onTriggerEnter / onTriggerExit instead of resolving contacts. See
Collisions & triggers.
Collision layers
Section titled “Collision layers”Two bitmasks (each up to 16 bits) control what interacts with what:
collisionGroups— the layers this collider belongs to.collisionFilter— the layers this collider interacts with.
Two colliders interact only when each one’s group is in the other’s filter. Name your 16 layers in the scene environment so the masks read meaningfully.
The physics debug view
Section titled “The physics debug view”Press P at runtime to toggle a wireframe overlay of every collider, drawn from
rapierWorld.debugRender() into a Three.js LineSegments
(packages/engine/src/setup/setup-physics.ts). It’s the fastest way to confirm a collider’s
shape and placement match the visual mesh.
See also
Section titled “See also”- Rigid bodies — what a collider attaches to.
- Collisions & triggers — reacting to overlaps.
- Scene Schema reference — every collider field.