How to use Cinemachinie Virtual Camera Extensions: Camera Shake with Impulse Listener
--
A well timed camera shake can really add a lot of player immersion to your game. Rather than using a custom camera shake script, let’s take a look at using cinemachine to shake the camera with an impulse listener. If you want to read about writing a custom camera shake script, please check out my article here https://medium.com/nerd-for-tech/refactoring-the-camera-shake-in-unity2d-628664c6f871,
The next cinemachine extension in this series is the Impulse Listener. Just navigate down to the Extensions option on your virtual camera and select the Impulse Listener option to add the script component.
The attached script needs a Raw Signal input to be assigned, under the Signal Shape header.
Create a new Noise Settings in your Project folder by navigating to Cinemachine>Noise Settings.
Per the Unity documentation, the ‘Noise Settings generates Basic Multi-Channel Perlin noise for Cinemachine Virtual Cameras’. You can ‘add noise in up to six dimensions, including three rotational and positional axes’.
For this example I will only be adding positional noise, so I expand the drop-down for each axis(X, Y, Z). Under Components where it says List is Empty, click the plus icon to add Frequency and Amplitude components.
The X-axis is assigned Frequency(shake speed) and Amplitude(shake intensity) values of 1. The Red line represents the noise wave on the X, while the Position Noise window all the way at the top will show the final mixed values if all three axis inputs.