Experiment with universal gravitation in a symplectic N-body gravity simulation sandbox: tap anywhere to spawn an orbiting planet, pull back and drag to slingshot comets at custom velocities, or watch binary stars and planetary mergers evolve live.
Because orbital trajectories drift rapidly under naive Euler steps, this gravity simulator runs a 4th-order symplectic Yoshida integrator that preserves angular momentum and energy bounds across hundreds of revolutions.
Every mass in space attracts every other mass simultaneously along the line connecting their centers, shrinking inversely with squared distance. Unlike fixed circular animations, a genuine N-body gravity simulation recomputes all mutual pairwise pulls between stars, planets, and launched probes at every substep.
Whether an object stays in a closed orbit or escapes forever depends strictly on speed compared to local escape speed √(2GM/r). Launching slower than circular speed √(GM/r) drops the object inward toward a tight ellipse; launching right around circular speed traces near-circles; exceeding √2 times circular speed unleashes an unbound hyperbolic escape.
In Binary Stars mode, two massive companions orbit their shared center of mass while a distant circumbinary planet loops stably around both suns—demonstrating how real Tatooine-style exoplanets survive.
With Inelastic Planetary Mergers toggled on, colliding bodies conserve total linear momentum (m₁v₁ + m₂v₂)/(m₁+m₂) while merging mass and cross-sectional radius just like planetesimal accretion in early protoplanetary disks.
| Planet | Semi-Major Axis (AU) | Orbital Period | Mean Orbital Speed v_circ | Surface Escape Speed v_esc |
|---|---|---|---|---|
| Mercury | 0.387 AU | 88.0 days | 47.36 km/s | 4.25 km/s |
| Venus | 0.723 AU | 224.7 days | 35.02 km/s | 10.36 km/s |
| Earth | 1.000 AU | 365.25 days | 29.78 km/s | 11.19 km/s |
| Mars | 1.524 AU | 687.0 days | 24.07 km/s | 5.03 km/s |
| Jupiter | 5.204 AU | 11.86 years | 13.07 km/s | 59.50 km/s |
| Neptune | 30.07 AU | 164.8 years | 5.43 km/s | 23.50 km/s |
A 41-second animation: mutual N-body gravity, circular vs. escape speed (√2), and gravitational slingshots.
Run Solar System Orbits, double Central Star Mass M from 18 to 36 M☉, and watch circular orbits pull inward into tighter faster ellipses.
Open Empty Star Sandbox, drag slowly near the star for a steep grazing comet orbit, then drag strongly beyond v_esc to fling a probe out to infinity.
Select Slingshot Gravity Assist and watch the fast blue probe swing behind the giant orange planet to gain or redirect orbital speed without firing rockets.
Newton's third law cuts both ways: every planet tugs back on the star, so both orbit their shared system barycenter. The effect becomes dramatic with heavy binary stars or massive gas giants.
A slower tangential speed cannot balance gravity at the launch radius, so the planet falls inward into an eccentric ellipse whose periapsis dips closer to the star before whipping back outward.
In the Sun's frame, swinging behind a moving planet steals an imperceptible fraction of the planet's orbital momentum—accelerating the tiny spacecraft by kilometers per second.
Using a 4th-order symplectic Yoshida composition avoids artificial energy damping or spiral bloat typical of basic arcade physics engines.