Questing · 2026-06-22 · Physics Simulation · Orbital Mechanics · Zero Dependencies
SLING
Launch a probe into a miniature solar system. Planetary gravity bends your path. Pass close behind a moving planet and steal its momentum — the same trick that sent Voyager to the stars.
Open Sling →What is Sling?
Sling is a gravity-slingshot sandbox running entirely in your browser — no backend, no libraries, no text input. Three planets orbit a central star under real Newtonian gravity. You click and drag to aim a probe; the drag distance sets the launch speed (up to 4.2 px/frame). Release and the probe flies free, its path bent by every body in the system simultaneously. Pass close enough behind a moving planet and you exit with more speed than you entered — a genuine gravity assist.
The Physics — Velocity Verlet Integration
The simulation runs at two substeps per rendered frame using the Velocity Verlet algorithm — a second-order symplectic integrator that conserves energy far better than naïve Euler integration:
// compute acceleration at current position ax₀, ay₀ = Σ G·mᵢ·(xᵢ−x) / |rᵢ|³ // half-step position x_new = x + vx·dt + ½·ax₀·dt² // recompute acceleration at new position ax₁, ay₁ = Σ G·mᵢ·(xᵢ−x_new) / |rᵢ|³ // full-step velocity from average acceleration vx_new = vx + ½·(ax₀ + ax₁)·dt
This averaging of forces at the start and end of each step eliminates the systematic energy drift that Euler integration accumulates over hundreds of orbits. The planets remain stable in circular orbits indefinitely; probe trajectories that should escape actually escape, and near-misses produce the correct hyperbolic bend.
Gravity Assists — How They Work
A gravity assist (or gravitational slingshot) is not a special manoeuvre — it falls out of Newton's laws automatically. In the reference frame of the planet, the probe enters on a hyperbolic approach and exits on a hyperbolic departure at the same speed it arrived (conservation of energy in that frame). But in the solar-system frame, the planet is moving. The probe gains or loses the component of planetary velocity along its flyby direction:
// in the planet frame, |v_in| = |v_out| (energy conserved) // but the planet itself moves at v_planet // if probe passes BEHIND the planet (in its direction of motion): // v_probe_out ≈ v_probe_in + 2·v_planet·sin(δ/2) // where δ = deflection angle of the hyperbola // if probe passes IN FRONT of the planet: // the planet brakes the probe (Oberth cost)
To use this in Sling: aim your probe to intercept the gas giant Jove from slightly ahead of its orbital position. The probe will cross behind Jove's direction of travel and exit with measurably higher speed — watch the velocity readout bottom-left jump after the flyby. The same technique let Voyager 2 visit all four outer planets on a single tank of fuel in 1977.
The Solar System — Three Planets
The simulation uses three planets with circular initial orbits, each at the Keplerian velocity for their orbit radius under G = 0.095 and Msun = 800:
v_orbit = √(G · M_sun / r) Mercury r = 105 px mass = 18 v ≈ 0.87 px/f period ≈ 8 s Tierra r = 195 px mass = 40 v ≈ 0.64 px/f period ≈ 19 s Jove r = 315 px mass = 180 v ≈ 0.50 px/f period ≈ 40 s
Jove's larger mass and slower orbit make it the primary assist target: its gravitational sphere of influence extends roughly 16 px, and a close passage (within 24 px of its centre) produces a deflection of 20–40°. A well-timed probe launched at about 40% power, aimed to intercept Jove from the trailing side, will exit with >3× its launch speed and escape the system entirely.
Trajectory Preview
While dragging, Sling runs a fast forward-simulation to preview where your probe will travel. It steps 280 physics iterations ahead using a 2.4× coarsened timestep — fast enough to run 60 times per second without perceptible lag. The dotted preview line shows the predicted path under the current planetary positions; because planets move, the actual trajectory will diverge from the preview after a few orbits, making long-range planning a genuine skill rather than a solved puzzle. Press T to toggle the preview off for a purer challenge.
Controls
- Click and drag anywhere — drag direction and length set launch vector. Release to fire.
- R — reset the probe to its start position (keeps planets where they are).
- T — toggle the dashed trajectory preview on / off.
- Click after impact or escape to reset the probe and try again.
- Watch the velocity readout bottom-left: a successful gravity assist will spike it.
Why It's Different
Sling is the first Questing toy with zero text input — the entire interaction is spatial and temporal. Every prior Questing toy took words or rhythms or dates as seeds for deterministic generation. Sling takes none of that: you aim, you launch, the physics decides. The emergent learning curve (aim → miss → adjust → gravity assist → escape) mirrors how NASA mission planners actually practice trajectory design. The code is 300 lines of vanilla JS and Canvas 2D — no libraries, no shaders, no server.