Parameters
spacecraft position & velocity
Interactively simulate gravitational slingshot maneuvers. Adjust planet mass, velocity, and launch angle to see real-time velocity changes before and after flyby.
Newton's law of gravitation (force on spacecraft):
$$\vec{F}= -\frac{G M_p m}{r^2}\hat{r}$$Equations of motion in 2D (relative position $\vec{r}= (x-x_p,\,y-y_p)$):
$$\ddot{x}= -\frac{G M_p (x-x_p)}{r^3}, \qquad \ddot{y}= -\frac{G M_p (y-y_p)}{r^3}$$Numerical integration: 4th-order Runge–Kutta (RK4). Planet moves at constant velocity.
Maximum velocity gain from an ideal trailing-side flyby:
$V_p$: planet orbital speed. Achieved when velocity vector is deflected 180° in the planet frame.
Voyager 1 & 2 (1977): Multiple gravity assists at Jupiter and Saturn boosted both probes to solar escape velocity. Voyager 1 is now over 24 billion km from Earth — the most distant human-made object.
Cassini (1997): Four gravity assists (Venus ×2, Earth ×1, Jupiter ×1) delivered the Saturn probe with far less propellant than a direct trajectory would require.
MESSENGER (2004): Six gravity assists including three at Mercury progressively shed orbital energy for Mercury orbit insertion — the first spacecraft ever to achieve it.
Here are some points where beginners often get tripped up when mastering this simulator. A major misconception is the idea that the closer you get to a planet, the more you can accelerate. While gravity does get stronger as you approach, real missions are limited by the "planet's atmosphere" and the "Roche limit" (the distance at which a satellite would be torn apart). For example, a Jupiter flyby at an altitude of 100,000 km is safe, but lowering it to 10,000 km risks the probe being destroyed by intense radiation belts. Even if it's possible in the simulation, a "safety margin" is essential for a real spacecraft.
Next, tips for setting initial conditions. The "approach velocity" and "approach angle" relative to the planet determine everything. Here, "approach angle" refers to the spacecraft's relative direction of approach against the planet's velocity vector. To maximize the effect in the simulator, the basic principle is to approach from almost directly behind the planet's direction of travel, in a nearly straight line. For instance, if you set the planet's velocity to $V_p=13\,\text{km/s}$ and the approach velocity to $V_\infty=10\,\text{km/s}$, passing at the optimal angle does not yield a theoretical maximum velocity increment of $\Delta v \approx 2V_\infty \approx 20\,\text{km/s}$. That's only in the planet's reference frame; note that the increment seen from the solar system is much smaller (on the order of a few km/s). Always be mindful of the reference frame when adjusting parameters.
Finally, regarding the simplification of the "three-body problem". This tool uses a simple two-body (planet-spacecraft) model, approximating the Sun's gravitational influence by having the planet move in a straight line at constant velocity. Therefore, it's not suitable for predicting long-term trajectories in the real solar system. In practice, you need "n-body simulations" that simultaneously consider the gravity of multiple celestial bodies. Think of this tool purely as a first step to understanding the physical essence of the flyby phenomenon.
The computational techniques behind this gravity slingshot simulator are widely applied in the world of CAE. The first example that comes to mind is automotive crash safety simulation. Just as a spacecraft bends its trajectory in a planet's gravitational field, a vehicle during a collision changes its trajectory (= deformation mode) while absorbing kinetic energy within the non-linear force field of "deformation." Both share the commonality of solving the equations of motion for a time-evolving system through numerical integration (RK4 in this tool).
Another is ion implantation simulation in semiconductor manufacturing. This is the process of accelerating and deflecting charged particles (ions) with electromagnetic fields to implant them into a silicon wafer. The Lorentz force acting on the particles is a central force, and its trajectory calculation is mathematically very similar to motion in a gravitational field. The approach of varying parameters to find the optimal implantation angle and energy is essentially the same as flyby optimization.
From a broader perspective, it also connects to the particle tracking method (Lagrangian method) in fluid dynamics. The behavior of microparticles in a fluid being captured, accelerated, or decelerated by a flow field (e.g., a vortex) overlaps with how a spacecraft is influenced by the "flow" of a planet's gravitational field. In this way, even seemingly specialized aerospace engineering techniques share a common foundational technology with many engineering fields: the concept of "particle trajectory calculation within a field."
If this tool has sparked your interest in flybys, try taking the next step to dive deeper. The recommended learning path starts with understanding "conserved quantities". In a flyby, both energy and angular momentum are conserved in the planet's reference frame. Specifically, letting $r$ be the distance from the planet, $v$ the relative velocity, $G$ the gravitational constant, and $M$ the planet's mass, the specific energy $\varepsilon = \frac{v^2}{2} - \frac{GM}{r}$ and the specific angular momentum $h = |\vec{r} \times \vec{v}|$ remain unchanged before and after the flyby. From this fact, the relation $v_p^2 = \frac{2GM}{r_p} + 2\varepsilon$ between the periapsis distance $r_p$ and periapsis velocity $v_p$ is derived, which is the core determining the shape of the trajectory.
The next challenge is mastering the "patched conic approximation". This is an advanced approximation method that splits the flyby into a "hyperbolic trajectory near the planet" and "an elliptical trajectory with the Sun as a focus elsewhere" (patch), connecting the velocity vectors at the boundary (conic). Using this, you can roughly estimate the spacecraft's velocity within the solar system before and after the flyby with just paper and a calculator, without needing sequential integration like this simulator. It's an essential concept in practical orbital mechanics.
Finally, as a map for your future learning, keep in mind two major topics: "control optimization" and "probabilistic orbit determination". One is how to calculate the "optimal trajectory" that combines multiple flybys to reach a final destination (e.g., searching for an Earth-Jupiter-Saturn flyby trajectory using genetic algorithms). The other is "sensitivity analysis," which evaluates how unavoidable errors in orbit determination (e.g., a spacecraft position measurement error of a few kilometers) affect the accuracy of a flyby years later. These are the exciting next steps that bridge the gap from simulation to actual mission design.