// SIGNAL PIT

Signal Pit

A Three.js × Rapier physics sandbox that costs nothing when idle.

Signal Pitis the hero's dot-field taken into 3D and given mass: around 130 instanced spheres and cubes in a caged arena, with real rigid-body physics. The cursor is a force field, a click is a shockwave, and gravity is a button.

Stack

Three.js renders, Rapier (a Rust physics engine compiled to WASM) simulates. Both are imported dynamically inside the component, so the ~1.5 MB chunk loads only on /lab or when the homepage embed nears the viewport — never up front.

Two draw calls

All the bodies are drawn with two InstancedMeshes (one sphere, one cube). Each frame copies every body's transform from Rapier into the instance matrix, so 130 bodies cost two draw calls, not 130.

It sleeps

Rapier sleeps individual bodies when they stop; the pit extends that to the whole system. When every body reports isSleeping() and the pointer is idle, the render loop cancels itself and a HUD chip flips from LIVE to IDLE. It also hard-pauses off-screen and on tab-hide.

Mobile

Two fixes made it phone-friendly: the camera fits itself to the viewport aspect so portrait screens see the whole arena, and touch-action: pan-y lets vertical swipes scroll the page while horizontal drags and taps drive the physics. The homepage embed only mounts the live pit on capable machines; everyone else gets a CSS teaser linking here. Full write-up in the post.