Roll a marble through a physics-driven obstacle course
Roll a physics-driven marble through an endless obstacle course assembled from repeating track blocks. Distance raises the score and combo, while moving barriers cost one of three lives. Gems and temporary shield, speed, and slow-time pickups create short tactical windows before the course recycles ahead.
Four things that separate a marble runner that feels good from one that feels off — kinematic bodies driven by setNextKinematicTranslation (not setTranslation), a ray-cast grounded jump that can't be spammed mid-air, an "infinite" level that recycles blocks in place instead of growing an array, and per-frame camera lerp with reused scratch vectors. Straight from the /gamecenter 3D Race source.
Rapier's wasm loader returns a Promise, but a three.js render loop starts on `new`. If you naively `await RAPIER.init()` in the constructor, you get a black screen while wasm downloads. If you fire off `.then(...)` and forget about it, your first ticks crash on `world.step` because the world doesn't exist yet. Tank Battle threads this needle with a `physReady` flag, a purely-cosmetic pre-physics render loop, and a check-and-wait "deploy" gate.
Rapier surfaces contact detection through three interfaces on top of the same underlying check — the raw event queue, R3F's `onCollisionEnter` prop, and sensor colliders with `onIntersectionEnter`. Same feature, three ergonomics, different tradeoffs. This post walks through each shape with real call sites from Tank Battle and 3D Race, and where each one belongs.
Yes. 3D Race is free to play in a modern browser, with no download or installation required.
What kind of interactive game is 3D Race?
3D Race is a arcade interactive browser game. Roll a physics-driven marble through an endless obstacle course assembled from repeating track blocks. Distance raises the score and combo, while moving barriers cost one of three lives. Gems and temporary shield, speed, and slow-time pickups create short tactical windows before the course recycles ahead.
How do I play 3D Race?
Use WASD or the arrow keys to roll.; Press Space while grounded to jump.; On screens below 900 px, use the on-screen direction and jump buttons.