Gravity simulation
- POST
I have always been fascinated by gravity simulations, and I have vivid memories of small simulators where you would create celestial bodies and watch them in motion.
As I wanted to see what the fuss was about TypeScript, I decided to make a simple gravity simulator featuring planets. My goal was to simulate trajectories of around a dozen bodies in real-time, in the browser.
Everything is based on Newton’s second law: