OpenWorldLab

Drag anywhere and let go to launch a planet. Drag a star to move it.

Gravity

Orbital mechanics

Gravity: launch planets, throw stars

A sandbox for Newtonian gravity. Start with a calm solar system, fling planets past the star, or load one of the presets — each is a real solution from celestial mechanics, set running.

The controls

  • Launch a planet: press on empty space, drag away from where you want it to go, and let go. The further you pull, the faster it flies. While you drag, a dotted line predicts its path.
  • Move a star: drag it. Let go while still moving and the star keeps that speed, so you can throw it; pause before letting go and it is set down at rest. (Anchors added with + Star always stay put.)
  • + Star / + Black Hole adds an anchor: a star that stays where it is put (until you drag it) while everything else falls towards it. Up to eight.
  • Cluster adds five small planets on near-circular orbits around the centre.
  • Share copies a link that rebuilds this exact scene — every star and planet, where it is and how fast it is moving.
  • Presets loads one of the systems below, or a scene from a shared link.
  • Clear removes every planet and keeps the stars.

The presets

  • Planetary system. Five planets and an asteroid belt on near-circular orbits.
  • Comets. Long elliptical orbits that whip round the star at closest approach.
  • Binary star. Two stars orbiting their shared centre, with planets circling both.
  • Trojan swarms. Asteroids sharing a giant’s orbit, 60° ahead and behind it (L4 and L5).
  • Figure-eight. Three equal stars chasing each other round one figure-eight path.
  • Close encounter. Two stars with disks pass close; tides pull out long tails.

The binary, the Trojans and the figure-eight are exact solutions of the equations of motion, started with the published positions and velocities. Left alone they keep their shape; disturb them — launch a planet through, nudge a star — and see how robust each is. The Trojans survive a lot. The figure-eight is more delicate.

How it works

Every star pulls on every planet and on every other star with Newton’s inverse-square law. Planets pull on each other too, at a tenth of the strength, but not on the stars — they are too light to matter. The motion is worked out in eight small steps per screen frame, with a method that keeps orbits from slowly spiralling in or out.

Two things differ from the real sky. The pull between a star and a planet is softened at very short range, so a near miss curves the planet sharply instead of flinging it off at enormous speed. And two stars whose cores touch merge into one, keeping their combined mass and momentum. Masses are scaled to the size of your screen so the orbits take about as long on a phone as on a large monitor.

References