Law of Universal Gravitation

Two masses attract with a force proportional to the product of their masses and inversely proportional to the square of the distance.

Textbook model

F = G m₁m₂ ÷ r²

drawn here with velocity Verlet integration, which keeps the energy almost exact; the orbit closes into an ellipse.

Simplified game model

Forward Euler: update position and velocity from the old values

plain forward Euler gains a little energy every orbit, so the planet spirals outward. Fewer steps per orbit make the difference obvious.

The textbook model is also an idealization with simplified conditions; real phenomena have more factors.

Simulator

The gravitational constant G is 6.67430 × 10⁻¹¹ m³/(kg·s²) (CODATA 2022).

At just the right speed the orbit is a circle; faster or slower gives an ellipse.

How games use it

Planet and moon orbits in space games, gravity puzzles.

More laws in this category

Physics Laws Quiz Gravity & Friction

Sources

Checked: 2026-11-29