logo
By Lawrence

13 minutes

Guns and Bullets

A shover leans you toward the trees, and a rammer rides your door. All you can do is steer. Your car has no gun.

This lesson gives it one. It also gives the other side a gunner, so the shooting goes both ways.

Adding speeds

Throw a ball forward from a moving car and it does not start from rest. It already has the car's speed, and the throw adds its own on top:

v_round = v_car + v_muzzle

Your machine gun's rounds leave the muzzle, the open end of the barrel, at 150 m/s. Flat out, the car does 52 m/s:

on the road               52 + 150 = 202 m/s
from the driver's seat    202 − 52 = 150 m/s

The camera rides with the car, so on screen a tracer always pulls away at 150 m/s. A round lives 0.7 s and starts at the muzzle, 2.4 m in front of the car's middle:

reach   2.4 + 150 × 0.7 ≈ 107 m ahead of the car, at any speed

Leave the car's speed out, and the round does 150 m/s on the road while you chase it. Now the faster you drive, the shorter your gun:

Continue reading

Unlock the Full Course

Every lesson, the runnable examples, and the finished build — yours to keep.

$9one-time

Was this page helpful?

We read every note — tell us what's working and what isn't.

↑↓ NavigateEnter SelectEsc CloseCtrl+K Open Search