Force magnitude (arbitrary units, typically 0-5)
Distance from impact to camera
Distance where falloff begins. Default: 5
Distance where shake reaches zero. Default: 50
Shake intensity configuration
// Explosion at position
const explosionPos = new THREE.Vector3(10, 0, 10);
const distance = camera.position.distanceTo(explosionPos);
const intensity = calculateScreenShakeIntensity(
2.5, // Strong explosion
distance,
5, // Falloff starts at 5 units
40 // No shake beyond 40 units
);
cameraShake.addTrauma(intensity.trauma);
Calculate screen shake intensity based on impact and distance.
Automatically scales shake trauma with distance falloff, creating realistic responses where nearby impacts shake harder than distant ones.