acron.camera_shake¶
Trauma-based camera noise shake (the Godot FastNoiseLite idiom).
Callers add trauma (e.g. shoot 0.35, take-a-hit 0.75); it decays over time and
drives yaw/pitch/roll offsets by trauma**2 * max_angle * noise. Godot games
typically sample FastNoiseLite 1-D; we use Acron’s Perlin noise sampled along an
advancing time coordinate, one channel per axis (seed offsets), matching
get_noise_1d(seed, time).
The shake is an OFFSET composed on top of whatever orientation the camera has
when update() runs – aim the camera first (chase logic, look_at),
call update(dt) last, and the offset rides on that frame’s aim. A camera
nobody re-aims keeps its pose as the standing base; update() detects an
outside re-aim by comparing against the HPR it last wrote and adopts the new
pose as the base, so it never yanks a moving rig back to a stale orientation.
With zero trauma it writes nothing (beyond stripping its own leftover offset).
All tuning values are constructor parameters – take them from the game’s own
shake script. frequency is the tremble rate in noise units per second of
shake time; speed scales how fast shake time advances.
|
Applies a decaying trauma shake to a camera node's HPR each frame. |