HeadlinesBriefing favicon HeadlinesBriefing.com

Gravity: A Weekend‑Built Solar System Simulator with Newton to Einstein Physics

Hacker News •
×

Over a weekend, developer qunabu released Gravity, an interactive solar‑system simulator built with TypeScript, Three.js, and Vite. The project runs entirely client‑side, generating surface textures procedurally and offering an offline experience. It lets users step through orbital mechanics from Newtonian two‑body dynamics to Einsteinian curved spacetime, making abstract concepts concrete for students, hobbyists, and educators alike, researchers worldwide today, globally.

Gravity’s guided tour starts with a two‑body illustration: the Sun removed, Earth drifting straight, then adds the missing gravitational pull to form an orbit. Users can toggle a real‑scale N‑body mode that employs a symplectic leapfrog integrator, displaying energy drift at ~1e‑6%. The simulation pulls real J2000 orbital elements and solves Kepler’s equation each frame to ensure accuracy everywhere today.

Surface textures are generated on the fly from value‑noise, except Earth, which uses a real image. The visual scale can be toggled from true astronomical units to a logarithmic remap, keeping physics at real AU while improving visibility. The open‑source code on GitHub invites scrutiny and feedback, offering a hands‑on platform for physics educators and curious developers to deepen understanding today.