13 minutes
Sparks and Screen Shake
Clip a tree at 30 m/s and the car spins 132°. It is a huge crash, and the game acts as if nothing happened. No spark, no dust, and the camera never blinks.
RoadFX draws every crash. It also gives RoadCamera's shake its first hits, so a big one lands in your hands.
Trauma
A shake needs a size. RoadCamera keeps one number for it, trauma, from 0 to 1. Every hit adds to it, and time drains it at 1.6 a second. The camera moves by trauma squared, times shakeMax, which is 1.4 m:
Squaring keeps small numbers small and lets big ones through:
On screen the tap moves the view 1.1 px and is gone in 0.17 s. The crash moves it 15 px and shakes for half a second.

Continue reading
Unlock the Full Course
Every lesson, the runnable examples, and the finished build — yours to keep.