sketch-to-sim

Installation
SKILL.md

Sketch to sim

A film has one shape: a pencil sketch on a desk is read (parts labelled in orange handwriting, cleaned up into ink, measured), then lifts off the paper as white cut-outs that fill in as wood, then runs. The first run usually fails in an instructive way, a tweak rewinds it and changes one parameter, the second run works, a slow replay shows the key moment with measured speeds, and a "Build it yourself" panel lets you play with the parameters. Everything is physically simulated; nothing is keyframed except the camera.

Run every command from this skill's directory.

Setup

node scripts/setup.mjs

Installs three, Rapier and playwright-core into this directory, finds or downloads Chromium, checks ffmpeg, and renders a smoke frame of the example. Rendering uses the GPU (--use-angle=metal on macOS); on a machine without one it still works, slowly.

Workflow

1. Get the machine. If there is a sketch or photo, read it: list the parts, how they connect, what moves, and every dimension written on it. If there is no sketch, design the machine from the request. Either way, write down the chain of cause and effect in one line per stage ("ball rolls down ramp; hits first domino; ...") before any code. Each stage becomes a trigger.

2. Write machine.js in a project folder outside any repo. Copy the closer of the two examples (examples/rube-goldberg/ for chains of triggers, examples/trebuchet/ for a held lever that is released) and read references/spec.md. Parts are boxes, beams, balls, wheels and convex polygons in side view (x right, y up from the pencil ground line, metres); hinge() joins bodies; parameters may move parts but not resize them.

Installs
3
GitHub Stars
5
First Seen
Sep 23, 2026