Presets
Playback
Throw
Speed, angle, aim and the height of the hand or tee above the grass.
Object
Spin
Backspin lifts the ball, topspin dips it, a tilted axis bends it sideways (Magnus effect).
Air, wind and gravity
Target
A painted landing zone on the field. Press a button to let the optimiser choose the angle.
Options
Camera
Drag to orbit, wheel or pinch to zoom, right-drag to pan.
Quality
Layers
Model checks
The science
What this simulates
A ball (or a javelin-like athletics implement) leaves the hand or boot at a launch speed v, launch angle θ, aim direction and release height h. From then on only three things act on it: gravity, air drag and, if it spins, the Magnus lift. Nothing else is pushed on it after release. Everything is a neutral sports object: balls, a javelin and a painted landing target on the grass.
Equations
Newton's second law, integrated with a fourth-order Runge-Kutta scheme (step 2 ms):
m dv/dt = m g + FD + FM
Quadratic drag acts against the velocity relative to the air (so wind enters here):
FD = −½ ρ Cd A |vrel| vrel, with vrel = v − vwind and A = π r².
The Magnus force is perpendicular to both the spin axis and the relative velocity:
FM = ½ ρ CL A |vrel|² (ω̂ × v̂rel), with the lift coefficient CL = Cmax tanh(1.5 S / Cmax), spin parameter S = rω / |vrel| and Cmax = 0.35. Spin decays as ω(t) = ω0 e−t/τ.
Air density comes from altitude and temperature: p = 101325 (1 − 2.25577×10−5 h)5.256, ρ = p / (287.05 T).
Closed-form cases used as checks
Without air the flight is a parabola. The range from release height h is R = (v cosθ / g)(v sinθ + √(v² sin²θ + 2 g h)) and the best angle is θopt = atan(v / √(v² + 2 g h)), which is exactly 45° only when h = 0. A ball falling from rest through air with quadratic drag has the exact solution v(t) = vt tanh(g t / vt) with terminal speed vt = √(2 m g / (ρ Cd A)). The "Model checks" boxes compare the numerical integrator with these formulas, test energy conservation (launch energy = landing kinetic energy + work against drag) and test that halving the time step does not change the answer.
Why the best angle is below 45° in air
Drag takes more speed from a ball that spends a long time up high and fast. A flatter, quicker flight loses less energy to the air, so the optimum drops below 45° for fast, light, draggy objects such as a golf ball or a tennis ball, and it moves back toward 45° for heavy slow ones. Backspin adds lift and lets the best launch angle fall further; topspin pulls the ball down. Check the "Range vs launch angle" graph while you move the spin slider.
Honest simplifications
- The drag coefficient is a constant per object. Real balls have a "drag crisis":
Cdfalls sharply at a critical Reynolds number that depends on surface roughness (dimples, seams, panels). Use the Cd slider to explore it. - The Magnus coefficient is an empirical saturating curve that is realistic for balls with 0.02 < S < 0.3, not a fluid simulation. The javelin-like object has the lift switched off; real javelins generate aerodynamic lift and pitching moments that this point-mass model ignores.
- Wind is uniform and steady; there is no wind shear, turbulence or gust.
- The ball is a point mass: no rotation of the spin axis (precession) and no bounce, roll or ground friction after the first touch-down.
- Air density uses a standard-atmosphere pressure law and the ideal-gas law with the temperature you choose.
What to try
Things to try
- Press Set best angle, then switch the air off. How far does the optimum move from 45°? Is it bigger for the golf ball or for the basketball?
- Pick the Free kick preset and move the spin-axis tilt from 0 to 90°: backspin lifts the ball, side-spin bends it. Which way does it curve for a positive tilt?
- Set a target at 120 m and use Low arc and High arc. Two different angles land on the same spot - which one is more sensitive to a small error in speed or to wind?
- Choose Thin air, 3000 m and compare the golf-ball distance with sea level. Then switch to the Moon preset and watch the optimum angle return to 45°.
- Add a 10 m/s headwind and then a tailwind. The range lost to a headwind is larger than the range gained from an equal tailwind - why? (Hint: drag is quadratic in relative speed.)
- Keep an arc with Keep this arc, change one parameter, and compare the two arcs on the trajectory graph.