Inspiration
I loved building marble runs as a kid. I did not love stepping on the pieces afterwards. Specs let you build one right on the table in front of you, sized to that table, with nothing to pack away.
What it does
Marble Run Sketch is a Specs Lens where you draw the track yourself.
- Draw: pinch to start, move your hand, and let go. Your stroke becomes a solid 3D track.
- Add pieces: aim and pinch to place bells and dominoes.
- Pick a spot: pinch the funnel or any point on a track, and a gold ghost marble marks where the next marble will start.
- Drop: the marble rolls with real physics, rings bells, knocks over dominoes and lands in the bowl for a goal.
- Undo and Clear: take back the last thing you added, or start again with a fresh table.
A ready-made chain reaction is waiting when you open it: a spiral, a bell and a row of dominoes, with the last domino tipping a second marble into the bowl. Scored marbles stay in the bowl until it overflows.
How I built it
I planned the Lens with the hackathon's plan-lens interview, which produced the design brief in the repo, then built it in Lens Studio 5.23 with the CLAD coding agent.
- TypeScript components
- Spectacles Interaction Kit for pinch input
- UI Kit for the tool panel
- MeshBuilder to extrude tracks on the fly
- Lens physics for marbles, bells and dominoes
- World Query to find the table
- LEAF for automated testing
Challenges I ran into
- My first build was too glitchy to keep, so I rebuilt it from scratch around one chain reaction that had to work every time.
- With several tracks, the marble always dropped from the newest one. That felt wrong, so I added the drop-spot picker and its marker.
- I don't have Specs, so everything had to be proven in the preview. On a slow preview, even the tests were tricky: one failed because the marble had already rolled away before it could be measured, so the test now records the exact release point.
Accomplishments that I'm proud of
- All seven LEAF scenarios pass in the Lens Studio preview: draw to cup, undo, clear, all buttons, chain drop, domino chain and drop-spot choice.
- Watching a marble roll down a track I had just sketched and land in the bowl.
What I learned
Designing for glasses means deciding where everything lives: what sits on the table, where the panel goes and what you are looking at during the task. I also learned to separate what the logic proves from what only a real device can tell you.
What's next for Marble Run Sketch
- Test on real Specs. Hand-tracking feel and table detection outdoors are still unproven.
- Save and reload contraptions.
- Let friends build together.
Built With
- clad
- leaf
- lens-studio
- meshbuilder
- specs
- spectacles-interaction-kit
- spectacles-ui-kit
- typescript
- world-query