Presets
Playback
Aim
Ball and world
Environment and target
Layers
Model check
The science
Without air
Only gravity acts, so the horizontal speed stays vx = v0 cos(theta) and the vertical motion is uniformly accelerated: x(t) = v0 cos(theta) t, y(t) = h0 + v0 sin(theta) t - g t^2 / 2. Setting y = 0 gives the flight time T = (vy + sqrt(vy^2 + 2 g h0)) / g and the range R = vx T; the apex is H = h0 + vy^2 / 2g. From flat ground the range is v0^2 sin(2 theta) / g, best at 45 degrees; from a height h0 the best angle falls to atan(v0 / sqrt(v0^2 + 2 g h0)).
With air
The drag force on a ball is modelled as quadratic, F = (1/2) rho Cd A |v_rel| v_rel, so the acceleration is a = -k |v_rel| v_rel + g with k = rho Cd A / (2 m) and v_rel = v - wind. No closed form exists, so the page integrates the equations with a fourth-order Runge-Kutta method (time step 4 ms) and finds the landing and the apex by bisection inside the last step. A falling ball approaches the terminal speed sqrt(g / k). Drag shortens the range, makes the descent steeper than the climb and lowers the best angle below 45 degrees; the best angle shown is found numerically by golden-section search.
Simplifications
The drag coefficient Cd is held constant (a real ball changes Cd with its Reynolds number, and spin adds the Magnus force, which is ignored); the wind is a steady horizontal wind along the line of fire; the ground is flat; air density is constant with height. The launcher barrel and the target are drawn larger than life so they stay visible when the range grows, and the target radius used for the hit test is the radius that is drawn. Targets are painted pads only.
Independent checks on this page
(1) The numerical flight without drag matches the closed form for range, apex and time. (2) The searched best angle matches 45 degrees from the ground and the formula above from a height. (3) Mechanical energy is conserved without drag, and with drag the lost energy equals the integral of the drag power. (4) A long fall reaches the terminal speed, drag shortens the range, and a vanishing k returns the vacuum range.