Camera Shake in Unity

After much Googleing for how to do a camera shaking effect in Unity, I decided to write my own small script to accomplish the effect. It combines both positional movement with rotational movement to simulate closely an actual camera shake.

The two key variables are:


Shake_intensity determines the initial intensity of the shaking — how much variance to allow in the camera position.


Shake_decay controls is the amount that shake_intensity is decremented each update. It determines if the shake is long or short.





Unity Web Player. Install now!





C# (c# port by commenter georgeegonut. Thanks George!)