Build a 3D roller coaster where the sim runs actual AP Physics C, not a canned animation. Every level is basically an AP free-response question. You read the physics off the track, work out the answer on paper, build the coaster to match, and the sim checks your numbers. Math's wrong, you don't win.
Live demo: https://site-jade-sigma.vercel.app/
I made this for AP Physics C. The physics model, the levels, and the curriculum are my calls. I used AI to help write the TypeScript and grind through the implementation, and I left that visible instead of hiding it. More on how that worked in docs/notes.md.
- Velocity Verlet on an arc-length track. No physics-engine library doing it for me.
- Signed normal force with loop-detach, so a cart that's too slow at the top of a loop actually flies off the track.
- Physics primitives, each tied to one AP-C topic: spring launcher, friction zone, variable-force booster and brake, banked curve, exact loop, projectile phase, speed gates.
- A full energy budget tracked across the ride, friction counted as heat.
- Every primitive is unit-tested against a textbook formula, and every level is proven beatable by running the real sim headlessly off its own hint.
The engine writeup is in docs/physics-design.md. The level reasoning is in docs/curriculum.md.
Needs Node 18 or newer.
npm install
npm run dev
Then open the local address it prints, http://localhost:2000.
Other scripts:
npm run build # type-check, then production build
npm test # run the physics and level-solvability test suite
npm run preview # serve the production build locally
TypeScript for everything, Three.js for the 3D scene, Vite for the dev server and build, Vitest for the tests, and KaTeX to render the equations as real math notation.
Each primitive is checked against its closed-form formula, the core energy and loop-detach conditions are covered, and every level has a solvability test that plays the full sim headlessly and confirms it's beatable from its own hint. Run it with npm test.