Collision layers
Collision layers control what collides with what. Here the same red bodies rain onto two shelves that differ only in their layer: on the left they hit a blue shelf — a different layer — and pile up on it; on the right they hit a red shelf — their own layer — and fall straight through to the floor.
Drag to orbit
The layer table
Section titled “The layer table”Define layers when you create the world. Each layer lists which layers it collidesWith:
const world = await World.create({ layers: { ground: { collidesWith: ["red", "blue"] }, red: { collidesWith: ["ground", "blue"] }, // not "red" → red passes through red blue: { collidesWith: ["ground", "red"] }, // not "blue" → blue passes through blue },});Then assign each body to a layer by name:
world.createBody({ type: "dynamic", shape: Shape.box({ halfExtents: [0.4, 0.4, 0.4] }), layer: "red" });world.createBody({ type: "dynamic", shape: Shape.sphere(0.45), layer: "blue" });If you omit layers, jolt-ts uses a sensible default table with static and moving. See the Collision layers guide for broad-phase layers and numeric layer ids.
Related
Section titled “Related”- Collision layers guide — broad phase,
collidesWith: "all", and query filtering. - Sensors — detect overlaps without a collision response.