A small and simple, browser-based solar system sandbox.
Celestial bodies move under real Newtonian gravity (kinda like a N-body simulation), and are rendered in 3D with Three.js
- Real N-body gravity with a velocity Verlet integrator.
- At setup, the Sun and the eight planets are positioned as they are on the current date.
- The whole system is centered on its true center of mass.
- 3D view with orbit controls (rotate, zoom and pan).
- Colored orbit trails, each covering one orbit.
- Planet names labels.
- Time warper slider with pause checkbox.
- Date display showing the current simulated date.
More "real" sandbox features will come later, once everything works fine! :D
- Make something I enjoy (I love astrophysics, simulations, etc).
- Learn ThreeJS.
- Try to understand how games like Universe Sandbox work under the hood.
Requires Vite+
Clone the repo and cd into the project, then run:
vp install
vp devsrc
├── assets
├── main.ts
├── render
├── sim
│ ├── body.ts # Body type
│ ├── integrator.ts # gravity and veloticy Verlet steps
│ ├── scenarios/ # initial conditions
│ ├── units.ts # constants and units
│ └── vec3.ts # small vector helpers
└── style.css
Inspired by Universe Sandbox, a very cool and much more complete sandbox, feel free to check it out :D
MIT