How to use Cinemachinie Virtual Camera Extensions: Shake on Collision
Now that we have covered shaking the camera with player controls using an impulse listener, let’s explore shaking the camera when the player walks through a trigger.
Here I have a 3D cube object in the scene view with a collider set to Is Trigger. Add a new Component and search for Cinemachine Collision Impulse Source.
The Signal Shape needs a Raw Signal profile to be assigned.
Create a new Noise Settings like we did in the previous article, and assign it here.
Setup the Amplitude and Frequency along the X, Y and Z positional axes in the Noise Settings. This input will be what defines the position and intensity of the camera shake.
I select my main 3rd person virtual camera in the Hierarchy.
Check out the Add Extension option and look for the Cinemachine Impulse Listener.
Now in with my Player selected, the Layer can be set to Collider. If there is not a collider layer by default, feel free to create one.
We now come back to the cube trigger object, and navigate to the Trigger Object Filter header. Set the Layer Mask to be Collider, to match the Player.
That’s it! Go ahead and press play, then move through the trigger with your 3rd person character and watch the camera shake!
Please join me in my next article where I will talk about using the post-processing extension. Thanks for reading!