Neon line-riding WebXR game for Meta Quest 3 + Onewheel. Play: laserline.vercel.app
Neon line-riding for Meta Quest 3 + Onewheel. A color-shifting synthwave laser line draws itself across your real space in passthrough. Keep the board on it. Unbroken streaks raise the multiplier (x1 → x8) and the music builds layer by layer. Arches give bonus points, riding dead centre gives Perfect Line, and leaving the line muffles the music and breaks your streak.

It's a WebXR page (three.js, no build step, no audio files: every sound is synthesized live), so it runs in the Quest Browser.
Hosted: open https://laserline.vercel.app in the Quest Browser. Redeploy after changes with vercel deploy --prod --yes --scope mileswiesenthals-projects.
Over USB (no hosting needed):
./quest.sh
This runs adb reverse and opens http://localhost:8080 in the Quest Browser. After that first load the service worker caches everything, so you can unplug, go outside, and open the same URL with no connection.
Or host it anywhere with HTTPS (Vercel, GitHub Pages, Netlify). It's static files, so deploy the folder as-is.
node test/fidelity.mjs and node test/smoothviz.mjs out.svg measure and draw this. If it ends within 4 m of where it started it becomes a lap course (lap times); otherwise it's start → finish against the clock (best time saved).Courses live in the Quest Browser's storage for this site (Rename / Delete in the menu). The anchors live on the headset.

In the headset: tap Ride in passthrough, then:
Quest boundary: Off (default). The game asks the headset for its unbounded space and never for local-floor, which is what triggers the stationary / room-scale boundary prompt and the fade-out when you leave it. If a headset refuses unbounded, it falls back to the plain local space and puts the floor 1.65 m below your head. Set Quest boundary: Use it in Setup to go back to the normal boundary. If the headset still shows a boundary on some firmware, you can turn it off in the headset's own settings (developer mode). Tracking is happiest at dusk or in shade with some visual texture around. Bright sun or a featureless lot can make it drift. If the headset re-centres, the game resets and asks you to set up again.
| Piece | File |
|---|---|
| Arena polygon, distance-field grid, path planner, rider tracker | src/path.js |
| Wall map from depth + room scan, distance field, simulated worlds | src/obstacles.js, src/fieldworker.js |
| Depth sensor GPU readback, room-scan planes and meshes | src/depth.js |
| Drawn courses: smoothing, fixed-course planner, anchor alignment, storage | src/course.js |
| Streaks, multiplier levels, gates, rerouting | src/game.js |
| Laser ribbon + walls shader, arches, arena grid/fence, particles, shockwaves, text pops, HUD | src/visuals.js |
| Procedural synthwave engine + SFX | src/audio.js |
| Head pose → board position/heading; desktop rider + autopilot | src/rider.js |
| XR session, game flow, event → effects wiring | src/main.js |
Path planner. Each metre it scores 45 two-stage curvature plans over a horizon long enough to see a full U-turn coming. A plan costs more if it gets near the arena edge, runs alongside the line that's still ahead of you (a clean figure-8 crossing is allowed), or strays from a slowly wandering "style" curvature, which is what makes it windy. Curvature changes are rate-limited (clothoid-like), so the line is always smooth and never tighter than the difficulty's turn radius (Chill 5 m, Flow 3.6 m, Carve 2.6 m, and tighter only when a small arena forces it, never below 2.2 m).
The line. The laser is a ~3 cm core with a tight bloom and a short blade standing on it so it reads from a distance. On-line tolerance is ±42 cm (Chill), ±30 cm (Flow), ±20 cm (Carve), marked by faint ticks either side.
Passthrough. The Quest composites the eye buffer over the cameras as premultiplied alpha. Every glow material uses GLOW blending in visuals.js (colour adds, alpha = glow brightness), so dim pixels stay see-through. Plain AdditiveBlending writes alpha 1 and paints the ground black. Preview the effect on desktop with ?autostart&autopilot&fakept.
Walls. src/obstacles.js keeps a 20 cm grid of what's solid around you, fed by:
src/depth.js, WebXR depth-sensing): ~10 times a second the depth texture is sampled down to 48×24 on the GPU, read back without stalling the frame, and turned into world points. Anything from knee to just over head height is a hit; every reading clears the floor between you and it, so people and cars that move away disappear. The sensor sees only ~5 m, so a wall first shows up as a short strip: each straight run of hits is assumed to carry on 3 m past what's visible until a ray shows otherwise.plane-detection, mesh-detection) when you're in a room set up in Space Setup: walls, furniture and the room mesh, all known up front.A distance field over the grid (built in a worker, src/fieldworker.js) gives the planner clearance anywhere. Plans that come within 0.45 m of something solid are thrown out, and the line prefers ~1.7 m of room. When something new turns up on the line ahead, the line is cut 1 m in front of you and re-planned, swerving as tight as a onewheel carves (2.2 m radius) if it's close. Boxed in, it backs up the unridden part and turns for open space. A faint violet-to-red glow marks what it has detected, and the HUD says WALL! (with a warning tone) when you're within ~1.2 m.
Limits: nothing below ~30 cm (kerbs, potholes, steps down) counts, only what the depth camera has seen is avoided, and something wide that appears dead ahead at speed can still leave no room to dodge. You steer; the line helps.
Simulated check: npm test rides a walled car park and a street with a side turn and a dead end, seen only through a simulated 5 m, 100° depth sensor (and again with the walls known up front), 30 three-minute rides with no contact. node test/wallviz.mjs lot flow seen 90 out.svg draws one. On desktop, ?walls=lot or ?walls=street adds pretend walls seen through the same fake sensor.
Tracking. The board position is your head projected to the floor. Heading comes from your motion once you're rolling, and from where you're looking when you're nearly stopped. Wander more than 3.5 m from the line for about 2 s and it reroutes from where you are.
Music. Am–F–C–G at 108 BPM. x1 has pad and bass, x2 adds kick, x3 adds hats and arpeggio, x4 snare, x5 16th hats, x6 octave-up arp, x7 a supersaw lead. A master low-pass opens with every level and slams shut when you leave the line. Each gate plays the next note of a rising A-minor pentatonic run.
npm test # planner + game rules (4 arenas × 3 difficulties, walls) + drawn courses python3 -m http.server 8080 # then open http://localhost:8080
Useful URL flags:
?autostart&autopilot&wobble=0.6: desktop preview that rides itself (wobble > 0 drifts off the line to show streak breaks)&view=chase / &view=top: chase or top-down camera?emulate&autoride&timerraf: runs the real Quest code path under Meta's IWER Quest 3 emulator, with the emulated headset riding the line&room=office_small (or office_large, living_room…): loads a scanned room from @iwer/sem (needs npm install) so the emulator has real depth, planes and a room mesh; &sense=depth / &sense=scan uses only one source?walls=lot|street: desktop preview with simulated walls&nosw: skip the service workerDesktop keys: W/S throttle, A/D carve, Space = pinch (hold to end), P autopilot, C chase cam, Esc menu.
vendor/ holds three.js 0.186.1 and IWER 2.7.0, copied from node_modules so the game works offline.
You're riding a powered board while seeing the world through cameras. Use an empty private space, wear a helmet and pads, start slow, and stop if the passthrough stutters or tracking drifts. The arena fence glows orange near the edge and the HUD shows EDGE! (or WALL! in Anywhere mode), but it's a guide, not a guarantee: the depth sensor reaches only a few metres and doesn't see kerbs or holes.

MIT, see LICENSE. The bundled files in vendor/ are three.js and IWER, both under their own MIT licenses.