Orbit Lab

A small gravity sandbox. Every body pulls on every other. Give them a push — too slow and they fall in, too fast and they fly away, just right and they orbit.

Set masses and starting velocities, then watch gravity pull bodies into orbits, slingshots and collisions.

FreeOn this device

Starting conditions (edit numbers)
#massxyvxvy
1
2

Dimensionless units with G = 1, softened at short range; integrated with velocity Verlet at dt 0.005. Masses and sizes are fictional — this is a toy for intuition, not real trajectory prediction. Energy drifts slightly with the step size and is lost in mergers.

t = 0.00 · 2 bodies · energy -0.3773 (start -0.3773) · momentum (0.0000, 0.0000) · paused.

Controls

  • Choose a preset, or press Add body, set its mass and drag on the space: the length and direction of the drag set its starting velocity.
  • Run, Pause and Step move time on; Reset returns every body to its starting position and velocity.
  • Trails draw recent paths; Centre-of-mass view keeps the system's balance point still. Starting conditions can be edited as numbers; Export saves them with the current state.

The rules

  • Gravity follows an inverse-square law with G = 1, softened very close up so nothing becomes infinite.
  • Time advances in steps of 0.005 using velocity Verlet, a method that keeps orbits stable for a long time.
  • Bodies that touch merge into one, keeping total mass and momentum. Some energy is lost in every merger.

Scoring, saving and limits

No score. The status line shows total energy, momentum and mergers so you can see what is conserved.

Your starting conditions and view settings are kept on this device. A run always replays from those conditions.

Dimensionless, fictional masses — a toy for building intuition, not a model of any real planets or spacecraft. At most 32 bodies; trails keep the last 2,000 points.

Questions

Why does my satellite fall in?
It is too slow sideways. Orbiting means falling while moving sideways fast enough to keep missing.
Why does energy change a little?
Each time step is an approximation. Smaller steps drift less; mergers lose energy on purpose.
Can the star move?
Yes. It is an ordinary body, so its planets tug it too — that keeps the momentum books balanced.