Perlin noise based camera shake MonoBehaviour script for Unity3D, ready to attach to a Camera. Uses a coroutine-based execution that exits after the job is done. Should be relatively performant.
MIT License
Just a camera shake MonoBehaviour
script that you can attach to a Camera
as a component in Unity3D. I guess it can be ideal if you just need camera shake, and would rather not use the full Cinemachine package.
Overall it should be performant. Not that it matters a lot probably, but still. ;)
Camera
should be parented to another GameObject
, and that GameObject
should be moved, if your game requires a moving camera. But this is how we normally use cameras in Unity. However, the script does support non-zero initial camera positions and rotations..cs
file to your Assets
folder.Obviously, you'll need to add 'trauma' during runtime to initiate the camera shake. You can do this by directly accessing the public Trauma
property of the component. I used it with my own event system instead, but I commented out the event-related lines. Feel free to remove these if you're not gonna use any event system.
You can customize the following parameters of the Perlin noise based camera shake in the Inspector:
Hopefully none. If you happen to find any, let me know, and I'll fix them.
It appears that some people are using this component, so I added an explicit MIT licence for your peace of mind.