Virtual Camera Extensions in Unity’s Cinemachine
Objective: To understand what Virtual Camera Extensions are in Cinemachine.
Extensions are additional virtual camera components that can be added to a virtual camera to change their behaviour. Some examples include camera offsets, colliders, follow zoom, storyboard, impulse listener and post processing. Let’s take a look at a few below.
Cinemachine Camera Offset Extension
This is a simple extension that tells the virtual camera where to be offset and which setting should it be applied after — Body, Aim, Noise or Finalise. You also have the ability to be able to create your own extensions by deriving from the CinemachineExtension class.
Cinemachine Post Processing Extension
This extension allows you to add a post processing profile to the virtual camera. However, it requires a few steps to get setup first in order to use it.
- You must install Post Processing V2 from the Package Manager.
2. Add the component ‘Post Process Layer’ to the Unity camera that is in your scene which has the CinemachineBrain component attached to it.
3. Create a new profile in the extension and any post processing overrides you wish to apply.
This extension tells the virtual camera to actively move away from obstacles that could block the line of sight of the ‘LookAt’ target.
There is also an abundant amount of settings to be played around with here that include obstacle detection through tags and layers, avoid obstacles and what strategies it should implement to make this happen.