Projectile motion

step 0
Loading the engineShared by all simulations, so the next one opens instantly.
The physics

A ball thrown in a vacuum moves at constant speed sideways while it falls with constant acceleration. Galileo put the two motions together in his Two New Sciences (1638), showed that the path is a parabola, and found that a launch at 45° carries farthest. Air resistance spoils both results: the arcs lose their symmetry, the range shrinks, and the best angle drops below 45°. With drag that grows as the square of the speed there is no closed-form solution, so the path has to be computed numerically.

What you see

Nine balls leave the yellow launch point near the bottom left at the same moment and the same speed, at 10°, 20°, 30°, 40°, 45°, 50°, 60°, 70° and 80°. Each angle has its own color, a fading trail and a small label at the launch point. When a ball hits the floor it keeps only part of its vertical speed and bounces; its horizontal speed is not reduced. The side walls reflect the balls without loss. Lengths are in pixels and time in seconds.

Vacuum (no drag): perfect parabolas. With the default g=200 px/s² and launch speed of 320 px/s, the 45° ball lands about 530 pixels from the launch point after 2.3 seconds, the farthest of the nine. Complementary angles such as 40° and 50° land almost at the same spot, as sin⁡2θ predicts. After the bounces die down the balls slide along the floor and keep bouncing between the side walls.

Air resistance: drag coefficient c=0.0015 per pixel. The terminal speed g/c≈365 px/s is close to the launch speed, so drag matters a lot. The ranges shrink by 15 to 35 percent, more for the longer flights, the arcs come down more steeply than they went up, and the 40° ball now lands slightly ahead of the 45° ball.

High gravity: g=500 px/s² without drag. Every length scales as v02/g and every time as v0/g, so the arcs keep nearly the same shape but are 2.5 times smaller and 2.5 times quicker.

Governing equation

Each ball obeys

𝐫¨=𝐠−c|𝐫˙|𝐫˙,

integrated with velocity Verlet at a step of 1/120 s. Without drag the solution is

x(t)=v0tcos⁡θ,y(t)=v0tsin⁡θ−12gt2,

with range R=v02sin⁡2θ/g, largest at θ=45°. The launch point sits 16 pixels above the height at which the balls touch the floor, so the measured ranges come out slightly longer than R.

Parameters

g (px/s²): downward acceleration, 50 to 600 (default 200).

launch speed: the common initial speed in px/s, 100 to 600 (default 320). Without drag the range grows as v02.

drag coefficient: c in the equation above, 0 to 0.005 (default 0, a vacuum).

bounciness: the coefficient of restitution at the floor, 0 to 1 (default 0.65): the fraction of vertical speed a ball keeps at each bounce. At 0 the balls stop bouncing at once, at 1 they bounce back to full height.

angle labels: shows the launch angle next to the launch point.