Skip to content

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).

cuboid uses halfExtents, ball uses radius, capsule uses radius and halfHeight, trimesh from mesh geometry
The four collider shapes.
typeSizing fields
cuboidhalfExtents ([x, y, z] half-size)
ballradius
capsuleradius + halfHeight
trimeshbuilt from the entity’s mesh geometry
  • 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 (unless mass is set on the body).
  • offset — translation of the collider relative to the body origin.

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.

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.

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.

The editor running the scene with the physics debug view toggled on
The running scene with the physics debug overlay (toggled with P).