Why square the trauma value here?
float shake = trauma * trauma; offset = maxOffset * shake * noise(t);
- To make the shake last twice as long
- Small hits shake far less than big ones
- To keep the camera offset always positive
- To sync the shake with the music
With trauma in 0..1, squaring (or cubing) makes the response non-linear: light hits barely move the camera while big ones shake hard, and the shake eases out as trauma decays.
Play Game Dev ▸