Free · online · no sign-up

Gravity Sandbox

A free solar system sandbox you can play in the browser. Click and drag to launch planets around a Sun. This is a 2D gravity simulator, separate from the Solar System Simulator, and it is not a model of the real planets.

Open the Solar System Simulator

Play

Drag on the canvas to launch a planet.

How to play

What the physics actually does

Every body is a point mass in a flat plane, including the Sun. The Sun starts at the center with a mass of 20,000 in these play units. That mass is not a solar mass. The three starter planets have masses 6, 12 and 20, and a planet you launch has mass 8. Their drawn circles are only so you can see them. The physics does not use those radii, and bodies do not bounce or merge. They can pass through each other.

The acceleration of body A toward body B follows a softened form of Newton’s inverse-square law. With r the distance and a softening length ε, the magnitude is G times B’s mass times r, divided by (r² + ε²) to the power 1.5. Far from another body this is very close to G·M / r². Here G is 100 in pixel-and-second units, not the SI gravitational constant, and the softening length is 8 pixels. That cap is why the acceleration stays finite when two bodies overlap.

Positions are updated with the velocity Verlet method, in fixed steps of 1/120 second. The starter planets begin at 90, 150 and 220 pixels from the Sun, with a speed of √(G·MSun / distance). That is the circular-orbit speed around a Sun that does not move. The other planets pull too, and the Sun itself moves when they tug on it, so the paths are not perfect circles. The view stays centered on the Sun, which is why it remains in the middle of the canvas even if the whole system drifts.

This page is a toy. It does not use an ephemeris, and it does not show where Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus or Neptune are. Those worlds are in the interactive solar system.

Frequently asked questions

What gravity does this sandbox use?

Each body is a point mass. It accelerates toward every other body by G times that body's mass, along the line between them, using a softened inverse-square law. G is 100 in pixel-and-second units, not the SI constant. A softening length of 8 pixels keeps the acceleration finite when bodies overlap. The motion uses the velocity Verlet method in steps of 1/120 second. Drawn sizes are only visual: bodies do not collide, and they can pass through each other.

How do I launch a planet?

Click or touch the canvas and drag. The planet starts where you press. The arrow is the distance it will travel in one second, and letting go sets that velocity. Pause freezes the integration. Reset puts back the Sun and three starter planets. Trails can be switched off. The view stays centered on the Sun.

Is this a free solar system game of the real planets?

It is free and runs online in your browser, with no download and no sign-up. It is a toy gravity sandbox, not a model of the real Solar System and not a live sky map. There is no score and no account. For the Sun and eight planets in 3D, open the Solar System Simulator.