Skip to content

Sensors (triggers)

A sensor (a.k.a. trigger) detects overlaps but never pushes anything — perfect for pickups, checkpoints, and trigger volumes. On the left, shapes fall straight through a yellow sensor slab; on the right, an identical solid slab stops them. The only difference is sensor: true.

Drag to orbit

Loading physics…
Left: sensor (pass-through). Right: solid.
// Sensor: registers overlaps, applies no collision response.
world.createBody({
type: "static",
shape: Shape.box({ halfExtents: [1.8, 0.2, 1.8] }),
position: [-2.6, 2, 0],
layer: "moving",
sensor: true,
});
// Solid: the same body without the flag.
world.createBody({
type: "static",
shape: Shape.box({ halfExtents: [1.8, 0.2, 1.8] }),
position: [2.6, 2, 0],
layer: "static",
});

You can also flip a body at runtime — read body.isSensor(), and note that queries skip sensors unless you pass includeSensors: true.