Cinemachine Installation and User Guide
Cinemachine Installation and User Guide
1 User Manual
What is Cinemachine?
Cinemachine is a suite of ‘smart’ procedural modules which allow you to dene the shot and
they’ll dynamically follow your direction. Setup shots which track and compose motion in
realtime, like AI camera operators. The procedural nature makes them bug-resistant as they
always work to make the shot based on your direction. That’s great for gameplay, but they’re
also amazingly fast for cutscenes. Change an animation, a vehicle speed, ground terrain -
whatever - and Cinemachine will dynamically make the shot. You can use really telephoto
lenses and not have to update the cutscene if things change
History
Cinemachine has been in development over a number of years across multiple projects We’ve
been designing camera systems for almost 20 years and have shipped millions of AAA titles
across numerous genres. The Cinemachine team has an award winning cinematographer and
a senior engineer with heavy math skills. Also, we love this stuff to bits.
Mission
Our mission with Cinemachine is built to be an entirely unied camera system bridging
gameplay, cutscenes, from fully procedural cameras to entirely canned sequences and
everything in between.
1
Example Scenes
Please have a look at our example scenes. They are shipped with the package under
Assets/Cinemachine/Examples. This folder also includes some handy noise presets that you
can use as a starting point for implementing camera noise.
Forums
We have a busy discussion area on the forums.
[Link]
Can I really save all my tunings in Play mode?
Yes! Almost everything in Cinemachine saves in play mode so jump in and tune some cameras
while the game is running. When you think about it, it’s really the only way to do it. We want
you to get right into the zone and massage cameras at any point in your game - while you’re in
there playing it.
Our engineer spent a long time on our camera system and doesn’t want to change it.
We hear this a lot. It’s never fun to throw code away but you need to think about the big picture
of your project. If you can get up and running really quickly creating and tuning cameras without
further bothering your engineer, isn’t that an advantage? It’s doubtful your existing system
behaves exactly as desired in every scenario so there’s yet more coding to be done anyway.
Cameras are such a huge part of your project and good cameras can make the difference
between an OK game and an amazing one. Try running Cinemachine next to your existing
cameras and see what it’s like. If that engineer is still reluctant share this idea with them -
Rockets eject perfectly great booster sections to get into space. That camera code helped
push you into orbit! Great scenes are often left on the editing room floor. Make the decision
that’s best for your project.
How do you typically configure the cameras for a project?
Instead of one big ball-of-code camera trying to do everything, you make lots of custom vcams
for every given moment and turn them on when needed. Blending or cutting to a new camera is
as easy as turning one on. If the priority is the same or higher, CM will use the new camera and
blend to it based on how you’ve defined the default blend or any other blends in the C ustom
Blends section of the CM ‘Brain’ on the Main Camera.
I don’t want to drastically change the camera in X scenario, I just want a little tweak
Camera changes can be really subtle. You can duplicate your main camera, only change the
FOV or Composition and then blend to that camera just when a player enters a trigger volume.
You can turn on vcams with only the subtlest of differences to get exactly the behavior you want
in whatever situation. Projects can have many vcams all with only minor changes, ready and
waiting for whatever game scenario demands them.
When would I use the State Driven Camera? Why have so many camera rigs?
The SDC makes it super easy to link animations and states to different cameras. Picture your
character’s local-motion system and orbit camera. It makes your game feel so much more alive
when the camera shakes a bit more when your character is running, when the camera pulls
back to a larger orbit when they go outside, when the camera gets all close when the character
is sneaking around. The SDC allows you to craft the cameras to best suit what your player is
doing.
For example, one project in dev had 20+ different camera rigs all listening to animations and
game events. Stand, walk, sprint, jump, attack, >3 enemies arrive, inside, outside, trigger
volumes in particular areas of the map, health <20%, etc. So much control is easily possible.
Table of Contents
What is Cinemachine? 1
History 1
Mission 1
Example Scenes 2
Forums 2
Frequently asked questions 2
Overview 6
Cinemachine Virtual Camera 6
Cinemachine Brain 6
User Guide 8
Basic Virtual Cameras 9
CinemachineVirtualCamera 10
LensSettings 11
CinemachineComposer 12
CinemachineTransposer 14
CinemachineBasicMultiChannelPerlin 16
NoiseSettings 18
[Link] 18
[Link] 19
Brains and Blending 20
CinemachineBrain 20
CinemachineBlendDefinition 22
CinemachineBlenderSettings 22
[Link] 23
Follow Cams and Player Input 24
CinemachineOrbitalTransposer 24
[Link] 26
[Link] 27
CinemachineFreeLook 28
Tracked Dolly 31
CinemachineTrackedDolly 32
[Link] 33
CinemachinePath 34
[Link] 34
CinemachineSmoothPath 35
[Link] 35
[Link] 35
State-Driven Camera 36
CinemachineStateDrivenCamera 40
Collision Avoidance and Shot Evaluation 41
CinemachineCollider 41
CinemachineConfiner 42
CinemachineClearShot 43
Multiple Target Objects 44
CinemachineTargetGroup 44
[Link] 45
CinemachineGroupComposer 46
2D Environments 48
CinemachineFramingTransposer 48
Post-Processing Stack V1 51
CinemachinePostFX 51
Post Processing Stack V2 54
CinemachinePostProcessing 54
And the Rest 55
CinemachineFollowZoom 55
CinemachineDollyCart 55
CinemachineMixingCamera 56
CinemachineExternalCamera 56
SaveDuringPlay 57
Timeline Integration 58
Special Environments 60
Top-Down Games 60
Split-screen 60
Scripting 61
Overview
Cinemachine is a modular suite of camera tools for Unity which give AAA game quality controls
for every camera in your project. It’s an easy to install plugin which lets you add functionality to
cameras you’ve already got, or make new ones with amazing behaviors.
Cinemachine has been designed to be the entire unified camera system in your project but can
be used alongside your existing cameras as well. If you have a bunch of camera stuff working
already and just want to use Cinemachine for cutscenes or something specific, no problem at
all. However when you use it across your project it allows you to blend any camera to any other
camera in a gameplay-to-cutscene-and-back-seamlessly kind of way.
The heart of Cinemachine is two components; everything else builds on those. They are:
These modules have been designed, re-designed and re-designed again to offer the widest
range of possibilities with the least number of controls. The math driving these camera
behaviours is complex and sophisticated, having gone through many different scenarios across
all sorts of games.
The reason for the ‘virtual’ camera scenario is because Unity renders from the main camera.
Out-of-the-box Unity is limited to only one camera being active camera at a time – which makes
the blending of two shots effectively impossible. Cinemachine is engineered to solve this and
provide a wealth of simple, powerful functionality at the same time, allowing unsurpassed
camera behaviors which are fast and easy to setup.
Cinemachine Brain
This is the central Cinemachine component that does all the magic. It’s a component attached
to the Unity camera and it monitors all the Virtual Cameras in the scene and drives the Unity
camera using the shot it likes best.
Installation and Getting Started
Installing Cinemachine is easy.
1. The main camera has a little icon next to it in the scene
hierarchy. This indicates that your camera has been
Cinemachine-enabled using a new component: the
CinemachineBrain.
2. A new GameObject CM vcam1 with a
CinemachineVirtualCamera component, which is a single
camera or shot.
There’s more info below on how to use these new things. Don’t forget to check out the example
scenes included in Cinemachine/Examples/Scenes, and please visit our user forum at
[Link]
User Guide
This guide is organized in logical sections that cover the ground from simple basic setups all the
way through to advanced cinematic features of Cinemachine. Each of the classes and
behaviours that make up Cinemachine are described in detail.
Cinemachine is by no means limited to the classes and behaviours described here. It has an
open pipeline architecture, and we look forward to seeing the exciting new behaviours and
intelligence that our users will build into the system.
Basic Virtual Cameras
Each virtual camera is a ‘shot’, or a single camera. You can animate them directly or blend two
together to create camera moves. The reason they are ‘virtual’ cameras is to allow for blending,
camera selection based on priorities and the ability to have Cinemachine hold multiple cameras
in memory with the final product being presented to the current active Unity camera(s) which are
rendering.
Cinemachine allows you to create an unlimited number of virtual cameras, blend them together
with the result being presented to the single Unity camera. It does all this automatically.
● Priority: The priority of this shot. Equal or Higher value camera priorities compared to
the current camera priority will be activated. This allows for camera state machine
setups where cameras are called based on trigger volumes, animations, health states,
etc. Important cameras will trigger over lower priority ones.
● Lens Settings: What kind of lens to use for this shot: FOV, clipping planes, and dutch
(camera roll). Post-processing effects can also be included here.
● Body: Where the camera is placed in your scene, and procedural ways to ‘mount’ your
camera to any object and move the camera with it.
● Aim: What the camera looks at, and procedural ways to track and compose any
subject.
● Noise: Procedural Perlin multi-layered noise system for handheld behaviors, shakes,
and vibrations.
● Extensions: These are add-ons to the basic Cinemachine pipeline. Post-Processing
and Collision Avoidance are examples of standard extensions shipped with
Cinemachine. The API is open, so that you can author your own extensions as well.
The Solo Button in the Virtual Camera inspector panel will make the virtual camera temporarily
Live so that you can have immediate visual feedback in the game view when tweaking the
behavioural parameters of the camera.
The Game Window Guides checkbox toggles the visibility of any screen compositional guides
that the virtual camera might want to display in the game window. This toggle is a static global,
and applies to all virtual cameras.
The Save During Play checkbox enables the Cinemachine feature of taking camera settings
tweaks made while in Play mode, and propagating them back to the scene. This allows
in-game fine tuning of cameras without having to do a whole lot of copy/pasting. After you exit
play mode, the scene will be updated to reflect the changes made during play. Pressing Undo
will revert those changes.
The following sections describe the behaviours and classes that make up the Cinemachine
Virtual Camera, and some of its standard procedural components.
CinemachineVirtualCamera
This behaviour is intended to be attached to an empty Transform GameObject, and it represents
a Virtual Camera within the Unity scene.
The Virtual Camera will animate its Transform according to the rules contained in its
CinemachineComponent pipeline (Aim, Body, and Noise). When the virtual camera is Live, the
Unity Camera equipped with a CinemachineBrain will assume the position and orientation of the
virtual camera.
A virtual camera is not a camera. Instead, it can be thought of as a camera controller, not unlike
a cameraman. It can drive the Unity Camera and control its position, orientation, lens settings,
and PostProcessing effects. Each Virtual Camera owns its own Cinemachine Component
Pipeline, through which you provide the instructions for dynamically tracking specific game
objects.
A virtual camera is very lightweight, and does no rendering of its own. It merely tracks
interesting GameObjects, and positions itself accordingly. A typical game can have dozens of
virtual cameras, each set up to follow a particular character or capture a particular event.
● Live: The virtual camera is actively controlling the Unity Camera. The virtual camera is
tracking its targets and being updated every frame.
● Standby: The virtual camera is tracking its targets and being updated every frame, but no
Unity Camera is actively being controlled by it. This is the state of a virtual camera that is
enabled in the scene but perhaps at a lower priority than the Live virtual camera.
● Disabled: The virtual camera is present but disabled in the scene. It is not actively
tracking its targets and so consumes no processing power. However, the virtual camera
can be made live from the Timeline.
The Unity Camera can be driven by any virtual camera in the scene. The game logic can
choose the virtual camera to make live by manipulating the virtual cameras’ enabled flags and
their priorities, based on game logic.
In order to be driven by a virtual camera, the Unity Camera must have a CinemachineBrain
behaviour, which will select the most eligible virtual camera based on its priority or on other
criteria, and will manage blending.
Look At Transform The object that the camera wants to look at (the Aim target). If
this is null, then the vcam’s Transform orientation will define the
camera’s orientation.
Follow Transform The object that the camera wants to move with (the Body target).
If this is null, then the vcam’s Transform position will define the
camera’s position.
Lens LensSettings Specifies the lens properties of this Virtual Camera. This
generally mirrors the Unity Camera’s lens settings, and will be
used to drive the Unity camera when the vcam is active.
Priority Int32 The priority will determine which camera becomes active based
on the state of other cameras and this camera. Higher numbers
have greater priority.
LensSettings
Describes the FOV and clip planes for a camera. This generally mirrors the Unity Camera’s lens
settings, and will be used to drive the Unity camera when the vcam is active.
Orthographic Single When using an orthographic camera, this defines the half-height,
Size in world coordinates, of the camera view.
Near Clip Single This defines the near region in the renderable range of the
Plane camera frustum. Raising this value will stop the game from
drawing things near the camera, which can sometimes come in
handy. Larger values will also increase your shadow resolution.
Far Clip Plane Single This defines the far region of the renderable range of the camera
frustum. Typically you want to set this value as low as possible
without cutting off desired distant objects.
CinemachineComposer
This is a CinemachineComponent in the Aim section of the component pipeline. Its job is to aim
the camera at the vcam’s LookAt target object, with configurable offsets, damping, and
composition rules.
The composer does not change the camera’s position. It will only pan and tilt the camera where
it is, in order to get the desired framing. To move the camera, you have to use the virtual
camera’s Body section.
The vcam’s LookAt target is the Composer’s target. Common Composer targets: include bones
on a character like the upper spine or head bone, vehicles, or dummy objects which are
controlled or animated programmatically.
Once you’ve set the vcam’s LookAt target and are tracking something, you need to define
where you’d like it to be on the screen and how aggressively you’d like to camera to track it. The
degree of lag, or how tightly the camera follows the subject is defined by the two controls:
Horizontal/Vertical Soft Damping: Setting these values to zero means the camera will hard
track the subject and the blue regions above will act as rigid barriers locking the camera
movement to keep the target inside those values. Setting the larger will allow the target to
‘squish’ into the blue regions, giving you some really nice camera weight and lag. This is what
real camera operators do!. The vertical and horizontal values are separated so you can let the
camera squish more left to right or follow tighter up and down, etc.
SoftZone/DeadZone: Tune these to define where you want the subject to be onscreen. These
controls are incredibly versatile. The blue areas are the ‘squishy’ areas based on how much
horizontal/vertical damping you have, and the red areas define the ‘no pass’ limits where the
camera will always track the subject. Opening up the soft areas to create a ‘dead zone’ in the
middle allows you to make areas of the screen immune to target motion, handy for things like
animation cycles where you don’t want the camera to track the target if it moves just a little.
Tracked Object Vector3 Target offset from the target object’s center in target-local space.
Offset Use this to fine-tune the tracking target position when the
desired area is not the tracked object’s center.
Lookahead Time Single This setting will instruct the composer to adjust its target offset
based on the motion of the target. The composer will look at a
point where it estimates the target will be this many seconds into
the future. Note that this setting is sensitive to noisy animation,
and can amplify the noise, resulting in undesirable camera jitter.
If the camera jitters unacceptably when the target is in motion,
turn down this setting, or animate the target more smoothly.
Horizontal Single How aggressively the camera tries to follow the target in the
Damping screen-horizontal direction. Small numbers are more responsive,
rapidly orienting the camera to keep the target in the dead zone.
Larger numbers give a more heavy slowly responding camera.
Using different vertical and horizontal settings can yield a wide
range of camera behaviors.
Vertical Damping Single How aggressively the camera tries to follow the target in the
screen-vertical direction. Small numbers are more responsive,
rapidly orienting the camera to keep the target in the dead zone.
Larger numbers give a more heavy slowly responding camera.
Using different vertical and horizontal settings can yield a wide
range of camera behaviors.
Screen X Single Horizontal screen position for target. The camera will rotate to
position the tracked object here.
Screen Y Single Vertical screen position for target, The camera will rotate to
position the tracked object here.
Dead Zone Width Single Camera will not rotate horizontally if the target is within this
range of the position.
Dead Zone Height Single Camera will not rotate vertically if the target is within this range of
the position.
Soft Zone Width Single When target is within this region, camera will gradually rotate
horizontally to re-align towards the desired position, depending
on the damping speed.
Soft Zone Height Single When target is within this region, camera will gradually rotate
vertically to re-align towards the desired position, depending on
the damping speed.
Bias X Single A non-zero bias will move the target position horizontally away
from the center of the soft zone.
Bias Y Single A non-zero bias will move the target position vertically away from
the center of the soft zone.
CinemachineTransposer
This is a CinemachineComponent in the Body section of the component pipeline. Its job is to
position the camera in a fixed relationship to the vcam’s Follow target object, with offsets and
damping.
The Tansposer will only change the camera’s position in space. It will not re-orient or otherwise
aim the camera. To to that, you need to instruct the vcam in the Aim section of its pipeline.
Transposer is a component which mounts a camera to any object. It has a number of
advantages over just putting the camera under the object you want to have the camera follow.
Hood Cam, Door Cam, POV Cam, Missile Cam - if you want to mount the camera to something,
use Transposer.
● The position tuning is kept, even if the game is running. Tune a regular camera in game
mode and the position is lost once you quit, not with Transposer. Tune it up while the
game is running and you’re done.
● Add damping to the camera - if your camera follows something, the damping values can
give you some ‘weight’ to the camera so they feel smoother.
● Organization: Put all your cameras in one place, instead of having them hidden under all
sorts of assets in your project - you pick their targets vs. put the camera under them in
the hierarchy.
Follow Offset: The camera will go to the centre of the object you’re targeting in the Transposer
Camera Target, so if you want the camera to be further behind, put in some offsets. We default
at -10 so the camera is behind whatever you’re targeting.
Damping: Per channel damping which will cause the camera to lag behind the target. You can
control both the position damping, and the orientation damping.
Binding Mode: There’s options in the relationship between the camera and the target object.
● Lock To Target interprets the camera offset in target-local coords. As the target rotates,
the camera rotates around it to maintain the offset.
● Lock to Target With World Up is the same as the above but it keeps the camera pointing
up. Handy if your target flips over.
● Lock to Target On Target Assign mounts the camera relative to the target’s local
coordinate system at the time the camera is initialized. This offset remains constant in
world space, and the camera will not rotate along with the target
● World Space offsets positions the camera relative to the target in world coords no matter
what direction the target object is facing.
● Simple Follow this will follow the target at the desired distance and height while moving
the camera position as little as possible. This is quite similar to what a human camera
operator would do when instructed to follow a target.
These different modes do incredibly different things, so try them out and one should work well
for whatever your requirements are. The ‘Door Cam’ or ‘Hood Cam’ ideas would use L ocal
Space Locked To Target.
Binding Mode BindingMode The coordinate space to use when interpreting the offset from
the target. This is also used to set the camera’s Up vector,
which will be maintained when aiming the camera.
Possible Values:
- Lock To Target On Assign: Camera will be bound to the
Follow target using a frame of reference consisting of the
target’s local frame at the moment when the virtual camera was
enabled, or when the target was assigned.
- Lock To Target With World Up: Camera will be bound to the
Follow target using a frame of reference consisting of the
target’s local frame, with the tilt and roll zeroed out.
- Lock To Target No Roll: Camera will be bound to the Follow
target using a frame of reference consisting of the target’s local
frame, with the roll zeroed out.
- Lock To Target: Camera will be bound to the Follow target
using the target’s local frame.
- World Space: Camera will be bound to the Follow target
using a world space offset.
- Simple Follow: Offsets will be calculated relative to the
target, using Camera-local axes.
Follow Offset Vector3 The distance vector that the transposer will attempt to maintain
from the Follow target.
X Damping Single How aggressively the camera tries to maintain the offset in the
X-axis. Small numbers are more responsive, rapidly translating
the camera to keep the target’s x-axis offset. Larger numbers
give a more heavy slowly responding camera. Using different
settings per axis can yield a wide range of camera behaviors.
Y Damping Single How aggressively the camera tries to maintain the offset in the
Y-axis. Small numbers are more responsive, rapidly translating
the camera to keep the target’s y-axis offset. Larger numbers
give a more heavy slowly responding camera. Using different
settings per axis can yield a wide range of camera behaviors.
Z Damping Single How aggressively the camera tries to maintain the offset in the
Z-axis. Small numbers are more responsive, rapidly translating
the camera to keep the target’s z-axis offset. Larger numbers
give a more heavy slowly responding camera. Using different
settings per axis can yield a wide range of camera behaviors.
Pitch Damping Single How aggressively the camera tries to track the target rotation’s
X angle. Small numbers are more responsive. Larger numbers
give a more heavy slowly responding camera.
Yaw Damping Single How aggressively the camera tries to track the target rotation’s
Y angle. Small numbers are more responsive. Larger numbers
give a more heavy slowly responding camera.
Roll Damping Single How aggressively the camera tries to track the target rotation’s
Z angle. Small numbers are more responsive. Larger numbers
give a more heavy slowly responding camera.
CinemachineBasicMultiChannelPerlin
As a part of the Cinemachine Pipeline implementing the Noise stage, this component adds
Perlin Noise to the Camera state, in the Correction channel.
The noise is created by using a predefined noise profile asset. This defines the shape of the
noise over time. You can scale this in amplitude or in time, to produce a large family of different
noises using the same profile.
The Noise is a multi-layered Perlin noise function which is applied after the Composer and adds
additional transforms. It has controls for Position and Orientation. You can add as many layers
as you want by increasing the profile’s Size value.
Procedural noise is a complex thing to make look real. Convincing hand-held motion is a
mixture of low, medium and high frequency wobbles which together combine to create
something believable.
Position / Orientation Size: This is how many noise functions you’d like to blend together for
the Position or Orientation or both. Mix at least 3 Orientation channels together for some
realistic hand-held motion.
Amplitude defines the amount of noise in degrees. Wider lenses will need larger degree values
in order to ‘see’ the shake. Telephoto lenses use smaller values as that small setting appears
amplified through narrower FOV lenses.
Frequency defines the speed of the noise in Hz. Typically a ‘low’ frequency value might be
around 0.1. Consider that your game is running at 30 or 60hz, so settings higher than that will
be ‘on the other side’ of the Nyquest frequency meaning that they will not be directly tracked. A
setting of 100 will be higher than what the camera can ‘follow’ as your game is only running at
say 60hz. It can look kind of choppy since the camera can’t track something which is sampling
faster than what the game is running at. It can also look kind of cool, but rarely. Experiment.
Typically, for most hand-held setups, the low is around 0.1-0.5, the mid maybe .8-1.5 and the
high around 3-4. That’s 3-4 shakes back and forth per second.
The most convincing camera shakes are typically done with Orientation noise as that’s where
the camera is aiming. Handheld camera operators tend shake more rotationally than they do
positionally, but of course feel free to mix in some Position noise, just remember it’s probably
best to start with the Orientation.
We’ve included a number of presets to get you going, under
Assets/Cinemachine/Examples/Presets/Noise and of course you can add as many of your own
as you wish, just right click in the Asset window Create->Cinemachine->Noise, and drag that
asset into the Noise Settings window under that Virtual Camera. You can also animate the
Noise through the Amplitude Gain and Frequency Gain settings to ramp the effect up and down.
Noise Profile NoiseSettings The shared asset containing the Noise Profile. Define the
frequencies and amplitudes there to make a characteristic noise
profile. Make your own or just use one of the many presets.
Amplitude Single Gain to apply to the amplitudes defined in the NoiseSettings
Gain asset. 1 is normal. Setting this to 0 completely mutes the noise.
Frequency Single Scale factor to apply to the frequencies defined in the
Gain NoiseSettings asset. 1 is normal. Larger magnitudes will make
the noise shake more rapidly.
NoiseSettings
This is an asset that defines a noise profile. A noise profile is the shape of the noise as a
function of time. You can build arbitrarily complex shapes by combining different base perlin
noise frequencies at different amplitudes.
The frequencies and amplitudes should be chosen with care, to ensure an interesting noise
quality that is not obviously repetitive.
As a mathematical side-note, any arbitrary periodic curve can be broken down into a series of
fixed-amplitude sine-waves added together. This is called fourier decomposition, and is the
basis of much signal processing. It doesn’t really have much to do with this asset, but it’s super
interesting!
Position TransformNoiseParams[] These are the noise channels for the virtual camera’s
position. Convincing noise setups typically mix low,
medium and high frequencies together, so start with a
size of 3.
Orientation TransformNoiseParams[] These are the noise channels for the virtual camera’s
orientation. Convincing noise setups typically mix low,
medium and high frequencies together, so start with a
size of 3.
[Link]
Describes the behaviour for a channel of noise.
Amplitude Single The amplitude of the noise for this channel. Larger numbers vibrate
higher.
Frequency Single The frequency of noise for this channel. Higher magnitudes vibrate
faster.
[Link]
Contains the behaviour of noise for the noise module for all 3 cardinal axes of the camera.
When it’s time to transition from one shot to another, you can choose how this transition is
accomplished. It can be a camera cut, or a Cinemachine blend. Cinemachine Blends are
special: they are not fades, or wipes, or dissolves. Rather, they are an interpolation of one
camera’s settings to another. Think of a blend more as if one cameraman smoothly passed the
camera to another cameraman in a different position, to elegantly transition the shot without a
cut.
CinemachineBrain
CinemachineBrain is the link between the Unity Camera and the Cinemachine Virtual Cameras
in the scene. It monitors the priority stack to choose the current Virtual Camera, and blend with
another if necessary. Finally and most importantly, it applies the Virtual Camera state to the
attached Unity Camera.
The CinemachineBrain is also the place where rules for blending between virtual cameras are
defined. Camera blending is an interpolation over time of one virtual camera position and state
to another. If you think of virtual cameras as cameramen, then blending is a little like one
cameraman smoothly passing the camera to another cameraman. You can specify the time
over which to blend, as well as the blend curve shape. Note that a camera cut is just a zero-time
blend.
● Blend Settings: This is the array which defines how any shot blends to any other shot.
You can have a 4 second blend from CameraA to CameraB, but a 1 second blend from
CameraB back to CameraA. This is very powerful when used in a state machine type
setup. If a specific blend between two cameras isn’t defined, it uses the Default
Blend which by default is a smooth 2-second blend (but you can change this).
● Layer Filter: The Brain will only notice those virtual cameras that pass its Unity
Camera’s culling mask. You can set up split-screen environments by assigning different
Virtual Cameras to different layers, and using the culling mask to filter them.
● Event Dispatching: The brain will fire events when the shot changes, in case you need
to monitor this. There in an event for whenever a Virtual Camera goes live, and another
event for when the camera cuts (so that temporal post effects can be reset).
Setting Type Description
Show Debug Text Boolean When enabled, the current camera and blend will be
indicated in the game window, for debugging.
Show Camera Boolean When enabled, the camera’s frustum will be shown at all
Frustum times in the scene view.
Ignore Time Scale Boolean When enabled, the cameras will always respond in
real-time to user input and damping, even if the game is
running in slow motion.
World Up Override Transform If set, this object’s Y axis will define the worldspace Up
vector for all the virtual cameras. This is useful for
instance in top-down game environments. If not set, Up is
worldspace Y. Setting this appropriately is important,
because Virtual Cameras don’t like looking straight up or
straight down.
Update Method UpdateMethod Use FixedUpdate if all your targets are animated during
FixedUpdate (e.g. RigidBodies), LateUpdate if all your
targets are animated during the normal Update loop, and
SmartUpdate if you want Cinemachine to do the
appropriate thing on a per-target basis. SmartUpdate is
the recommended setting.
Possible Values:
- Fixed Update: Virtual cameras are updated in sync with
the Physics module, in FixedUpdate.
- Late Update: Virtual cameras are updated in
MonoBehaviour LateUpdate.
- Smart Update: Virtual cameras are updated according
to how the target is updated.
Default Blend CinemachineBle The blend that is used in cases where you haven’t
ndDefinition explicitly defined a blend between two Virtual Cameras.
Custom Blends CinemachineBle This is the asset that contains custom settings for blends
nderSettings between specific virtual cameras in your scene.
Camera Cut Event BrainEvent This event will fire whenever a virtual camera goes live
and there is no blend.
Camera Activated VcamEvent This event will fire whenever a virtual camera goes live. If
Event a blend is involved, then the event will fire on the first
frame of the blend.
CinemachineBlendDefinition
Definition of a Camera blend. This struct holds the information necessary to generate a suitable
AnimationCurve for a Cinemachine Blend.
Possible Values:
- Ease In Out: S-shaped curve, giving a gentle and smooth transition.
- Ease In: Linear out of the outgoing shot, and easy into the incoming.
- Ease Out: Easy out of the outgoing shot, and linear into the incoming.
- Hard In: Easy out of the outgoing, and hard into the incoming.
- Hard Out: Hard out of the outgoing, and easy into the incoming.
CinemachineBlenderSettings
Asset that defines the rules for blending between Virtual Cameras.
The From and To settings are name-based, which means that cameras are found by matching
their names to the settings. They are not linked to specific game objects.
Blender supports wildcards called **ANY CAMERA**, which you can use on the input or
output of blends so that no matter what camera you’re in, you only have to specify one blend to
a particular shot if you always want to blend into or out of that shot the same way.
Custom CustomBlend[] The array containing explicitly defined blends between two
Blends Virtual Cameras.
[Link]
Container specifying how two specific Cinemachine Virtual Cameras blend together.
Because Cinemachine is a modular system, it’s easy to replace the Transposer in the Body
section with a different component - one that considers the velocity of the Follow target, and
player input coming from various HIDs. One such component is the O rbitalTransposer.
Building on the OrbitalTransposer, the CinemachineFreeLook c amera is a complex rig that
allows the player to position the camera in 2 dimensions: horizontally using the
OrbitalTransposer, and vertically using a super-powerful custom blending of 3 interrelated child
rigs.
Player input is accomplished either by setting up axes in the Unity Input Manager, or you can
drive the values directly using any custom or proprietary input system.
CinemachineOrbitalTransposer
This is a CinemachineComponent in the the Body section of the component pipeline. Its job is to
position the camera in a variable relationship to a the vcam’s Follow target object, with offsets
and damping.
This component is typically used to implement a camera that follows its target. It can accept
player input from an input device, which allows the player to dynamically control the relationship
between the camera and the target, for example with a joystick.
The OrbitalTransposer introduces the concept of Heading, which is the direction in which the
target is moving, and the OrbitalTransposer will attempt to position the camera in relationship to
the heading, which is by default directly behind the target. You can control the default
relationship by adjusting the Heading Bias setting.
If you attach an input controller to the OrbitalTransposer, then the player can also control the
way the camera positions itself in relation to the target heading. This allows the camera to move
to any spot on an orbit around the target. You can configure the OrbitalTransposer to take its
input from any axis previously set up in the Input Manager, or you can control the value directly
using any custom input system.
Another feature of the OrbitalTransposer is automatic recentering. When enabled, it will
automatically move the camera back to the default target heading after is has detected no user
input for a specified time.
Setting Type Description
Heading Heading The definition of Forward. Camera will follow behind.
Recenter To Recentering Automatic heading recentering. The settings here defines how the
Target camera will reposition itself in the absence of player input.
Heading
X Axis Heading Control. The settings here control the behaviour of the
AxisState
camera in response to the player’s input.
Binding Mode BindingMode The coordinate space to use when interpreting the offset from the
target. This is also used to set the camera’s Up vector, which will
be maintained when aiming the camera.
Possible Values:
- Lock To Target On Assign: Camera will be bound to the Follow
target using a frame of reference consisting of the target’s local
frame at the moment when the virtual camera was enabled, or
when the target was assigned.
- Lock To Target With World Up: Camera will be bound to the
Follow target using a frame of reference consisting of the target’s
local frame, with the tilt and roll zeroed out.
- Lock To Target No Roll: Camera will be bound to the Follow
target using a frame of reference consisting of the target’s local
frame, with the roll zeroed out.
- Lock To Target: Camera will be bound to the Follow target
using the target’s local frame.
- World Space: Camera will be bound to the Follow target using a
world space offset.
- Simple Follow: Offsets will be calculated relative to the target,
using Camera-local axes.
Follow Offset Vector3 The distance vector that the transposer will attempt to maintain
from the Follow target.
X Damping Single How aggressively the camera tries to maintain the offset in the
X-axis. Small numbers are more responsive, rapidly translating
the camera to keep the target’s x-axis offset. Larger numbers give
a more heavy slowly responding camera. Using different settings
per axis can yield a wide range of camera behaviors.
Y Damping Single How aggressively the camera tries to maintain the offset in the
Y-axis. Small numbers are more responsive, rapidly translating
the camera to keep the target’s y-axis offset. Larger numbers give
a more heavy slowly responding camera. Using different settings
per axis can yield a wide range of camera behaviors.
Z Damping Single How aggressively the camera tries to maintain the offset in the
Z-axis. Small numbers are more responsive, rapidly translating the
camera to keep the target’s z-axis offset. Larger numbers give a
more heavy slowly responding camera. Using different settings
per axis can yield a wide range of camera behaviors.
Pitch Single How aggressively the camera tries to track the target rotation’s X
Damping angle. Small numbers are more responsive. Larger numbers give
a more heavy slowly responding camera.
Yaw Damping Single How aggressively the camera tries to track the target rotation’s Y
angle. Small numbers are more responsive. Larger numbers give
a more heavy slowly responding camera.
Roll Damping Single How aggressively the camera tries to track the target rotation’s Z
angle. Small numbers are more responsive. Larger numbers give
a more heavy slowly responding camera.
[Link]
Axis state for defining how this CinemachineOrbitalTransposer reacts to player input. The
settings here control the responsiveness of the axis to player input.
Setting Type Description
[Link]
Controls how automatic orbit recentering occurs.
Heading HeadingDefinition How ‘forward’ is defined. The camera will be placed by default
Definition behind the target. PositionDelta will consider ‘forward’ to be
the direction in which the target is moving.
Possible Values:
- Position Delta: Target heading calculated from the
difference between its position on the last update and current
frame.
- Velocity: Target heading calculated from its Rigidbody’s
velocity. If no Rigidbody exists, it will fall back to
[Link].
- Target Forward: Target heading calculated from the Target
Transform’s euler Y angle.
- World Forward: Default heading is a constant world space
heading.
Velocity Int32 Size of the velocity sampling window for target heading filter.
Filter This filters out irregularities in the target’s movement. Used
Strength only if deriving heading from target’s movement (PositionDelta
or Velocity).
Heading Bias Single Where the camera is placed when the X-axis value is zero.
This is a rotation in degrees around the Y axis. When this
value is 0, the camera will be placed behind the target.
Nonzero offsets will rotate the zero position around the target.
CinemachineFreeLook
The FreeLook is a Cinemachine Camera geared towards a 3rd person camera experience. The
camera orbits around its subject with three separate camera rigs defining rings around the
target. Each rig has its own radius, height offset, composer, and lens settings. Depending on the
camera’s position along the spline connecting these three rigs, these settings are interpolated to
give the final camera position and state.
Player input is supplied along 2 axes: the X axis which controls the orbital position (see
CinemachineOrbitalTransposer), and the Y axis which controls the vertical position on the spline
connecting the 3 child rigs.
Each child rig can have its own Lens settings, or common shared values can be used.
Additionally, each child rig can have its own Composer and Noise settings.
Setting Type Description
Look At Transform Object for the camera children to look at (the aim target).
Follow Transform Object for the camera children wants to move with (the body
target).
Common Lens Boolean If enabled, this lens setting will apply to all three child rigs,
otherwise the child rig lens settings will be used.
Lens LensSettings Specifies the lens properties of this Virtual Camera. This
generally mirrors the Unity Camera’s lens settings, and will be
used to drive the Unity camera when the vcam is active.
Y Axis AxisState The Vertical axis. Value is 0..1. Chooses how to blend the child
rigs.
X Axis AxisState The Horizontal axis. Value is 0..359. This is passed on to the
rigs’ OrbitalTransposer component.
Heading Heading The definition of Forward. Camera will follow behind.
Recenter To Recentering Controls how automatic recentering of the X axis is
Target Heading accomplished.
Binding Mode BindingMode The coordinate space to use when interpreting the offset from
the target. This is also used to set the camera’s Up vector,
which will be maintained when aiming the camera.
Possible Values:
- Lock To Target On Assign: Camera will be bound to the
Follow target using a frame of reference consisting of the
target’s local frame at the moment when the virtual camera
was enabled, or when the target was assigned.
- Lock To Target With World Up: Camera will be bound to
the Follow target using a frame of reference consisting of the
target’s local frame, with the tilt and roll zeroed out.
- Lock To Target No Roll: Camera will be bound to the Follow
target using a frame of reference consisting of the target’s local
frame, with the roll zeroed out.
- Lock To Target: Camera will be bound to the Follow target
using the target’s local frame.
- World Space: Camera will be bound to the Follow target
using a world space offset.
- Simple Follow: Offsets will be calculated relative to the
target, using Camera-local axes.
Spline Single Controls how taut is the line that connects the rigs’ orbits,
Curvature which determines final placement on the Y axis.
Orbits Orbit[] The radius and height of the three orbiting rigs.
Priority Int32 The priority will determine which camera becomes active
based on the state of other cameras and this camera. Higher
numbers have greater priority.
Tracked Dolly
If you need your camera’s position to be confined to a dolly track, this can be done with a
combination of a CinemachinePath for the track, and a TrackedDolly for the Body component of
the virtual camera. There is a shortcut for creating this pair in the Cinemachine menu:
The path itself is defined by positioning waypoints. The CinemachinePath inspector provides a
simple interface for doing this. The waypoints are connected using a bezier, and you can
control how the interpolation occurs by manipulating the curve tangents at the waypoints. The
result of this is a camera track, drawn in the scene view in a manner resembling a railroad track.
It will not be drawn in the game view.
CinemachineTrackedDolly
A Cinemachine Virtual Camera Body component that constrains camera motion to a
CinemachinePath or a CinemachineSmoothPath. The camera can move along the path.
This behaviour can operate in two modes: manual positioning, and Auto-Dolly positioning. In
Manual mode, the camera’s position is specified by animating the Path Position field. In
Auto-Dolly mode, the Path Position field is animated automatically every frame by finding the
position on the path that’s closest to the virtual camera’s Follow target.
Path Cinemachine The path to which the camera will be constrained. This must be
PathBase non-null.
Path Position Single The p osition along the path at which the camera will be placed.
This can be animated directly, or set automatically by the
Auto-Dolly feature to get as close as possible to the Follow
target. The value is interpreted according to the Position Units
setting.
Position Units PositionUnits How to interpret Path Position. If set to Path Units, values are
as follows: 0 represents the first waypoint on the path, 1 is the
second, and so on. Values in-between are points on the path in
between the waypoints. If set to Distance, then Path Position
represents distance along the path.
Possible Values:
- Path Units: Use PathPosition units, where 0 is first waypoint,
1 is second waypoint, etc.
- Distance: Use Distance Along Path. Path will be sampled
according to its Resolution setting, and a distance lookup table
will be cached internally.
Path Offset Vector3 Where to put the camera relative to the path position. X is
perpendicular to the path, Y is up, and Z is parallel to the path.
This allows the camera to be offset from the path itself (as if on
a tripod, for example).
X Damping Single How aggressively the camera tries to maintain its position in a
direction perpendicular to the path. Small numbers are more
responsive, rapidly translating the camera to keep the target’s
x-axis offset. Larger numbers give a more heavy slowly
responding camera. Using different settings per axis can yield a
wide range of camera behaviors.
Y Damping Single How aggressively the camera tries to maintain its position in the
path-local up direction. Small numbers are more responsive,
rapidly translating the camera to keep the target’s y-axis offset.
Larger numbers give a more heavy slowly responding camera.
Using different settings per axis can yield a wide range of
camera behaviors.
Z Damping Single How aggressively the camera tries to maintain its position in a
direction parallel to the path. Small numbers are more
responsive, rapidly translating the camera to keep the target’s
z-axis offset. Larger numbers give a more heavy slowly
responding camera. Using different settings per axis can yield a
wide range of camera behaviors.
Camera Up CameraUpM How to set the virtual camera’s Up vector. This will affect the
ode screen composition, because the camera Aim behaviours will
always try to respect the Up direction.
Possible Values:
- Default: Leave the camera’s up vector alone. It will be set
according to the Brain’s WorldUp.
- Path: Take the up vector from the path’s up vector at the
current point.
- Path No Roll: Take the up vector from the path’s up vector at
the current point, but with the roll zeroed out.
- Follow Target: Take the up vector from the Follow target’s up
vector.
- Follow Target No Roll: Take the up vector from the Follow
target’s up vector, but with the roll zeroed out.
Pitch Damping Single How aggressively the camera tries to track the target rotation’s
X angle. Small numbers are more responsive. Larger numbers
give a more heavy slowly responding camera.
Yaw Damping Single How aggressively the camera tries to track the target rotation’s
Y angle. Small numbers are more responsive. Larger numbers
give a more heavy slowly responding camera.
Roll Damping Single How aggressively the camera tries to track the target rotation’s
Z angle. Small numbers are more responsive. Larger numbers
give a more heavy slowly responding camera.
Auto Dolly AutoDolly Controls how automatic dollying occurs. A Follow target is
necessary to use this feature.
[Link]
Controls how automatic dollying occurs.
Setting Type Description
Enabled Boolean If checked, will enable automatic dolly, which chooses a path
position that is as close as possible to the Follow target. Note:
this can have significant performance impact.
Position Offset Single Offset, in position units, from the closest point on the path to the
follow target.
Search Radius Int32 How many segments on either side of the current segment. Use
0 for Entire path.
Search Int32 We search a segment by dividing it into this many straight
Resolution pieces. The higher the number, the more accurate the result,
but performance is proportionally slower for higher numbers.
CinemachinePath
Defines a world-space path, consisting of an array of waypoints, each of which has position,
tangent, and roll settings. Bezier interpolation is performed between the waypoints, to get a
smooth and continuous path.
Resolution Int32 Path samples per waypoint. This is used for calculating path
distances.
Appearance Appearance The settings that control how the path will appear in the editor
scene view.
Looped Boolean If checked, then the path ends are joined to form a continuous
loop.
Waypoints Waypoint[] The waypoints that define the path. They will be interpolated using
a bezier curve.
[Link]
A waypoint along the path.
Tangent Vector3 Offset from the position, which defines the tangent of the curve at
the waypoint. The length of the tangent encodes the strength of
the bezier handle. The same handle is used symmetrically on
both sides of the waypoint, to ensure smoothness.
Roll Single Defines the roll of the path at this waypoint. The other orientation
axes are inferred from the tangent and world up.
CinemachineSmoothPath
Defines a world-space path, consisting of an array of waypoints, each of which has position and
roll settings. Bezier interpolation is performed between the waypoints, to get a smooth and
continuous path. The path will pass through all waypoints, and (unlike CinemachinePath) first
and second order continuity is guaranteed.
Looped If checked, then the path ends are joined to form a continuous
Boolean
loop.
Waypoints Waypoint[] The waypoints that define the path. They will be interpolated using
a bezier curve.
Resolution Int32 Path samples per waypoint. This is used for calculating path
distances.
Appearance Appearance The settings that control how the path will appear in the editor
scene view.
[Link]
A waypoint along the path.
[Link]
This class holds the settings that control how the path will appear in the editor scene view. The
path is not visible in the game view.
Path Color Color The color of the path itself when it is active in the editor.
Inactive Path Color The color of the path itself when it is inactive in the editor.
Color
Width Single The width of the railroad-tracks that are drawn to represent the
path.
State-Driven Camera
The State-Driven Camera is an implementation of a simple yet powerful concept: activate
specific shots when the subject enters specific animations states.
Even better, the blending between shots within the state-driven rig can be customized and
tuned to maximize the emotional punch of the transitions.
Using Cinemachine it’s possible to set up world-class 3rd person action adventure camera
systems. For example, you can create a unique Free-Look camera for events like this: Stand /
Walk, Run, Sprint, etc. Link the appropriate Cinemachine Free-Look camera up to that
animation state, so when the animation state is triggered it turns on that Cinemachine camera.
The idea is to simply blend into the right Free-Look camera for each animation state. Your
‘Sprint’ Free-Look gets in closer, the lens is wider and there is a ton of handheld noise. Boom,
you now have a ‘Roadie Run’ camera. This concept has been used to set up a complex camera
rig that had over 40 Free-Look cameras for a character’s local-motion and combat system, all
set up so quickly and all tuneable in real-time.
You first start with an animated target, i.e. something that has an Animator component
controlled by an FSM:
You then create a CinemachineStateDrivenCamera and connect the FSM to its Animated Target
Once you have set the Animated Target setting to point to a target object that has animation
states, the inspector editor will scan the target object for animation states and populate its
menus so that you can quickly and easily map available animation states to child vcams.
Next, create some state-to-camera mappings. You do that by clicking on the little + icon in the
state list:
This will add an entry in the state list, and you can then choose the state you want to handle, and
the virtual camera child to map it to.
The available cameras are the virtual camera children of the StateDrivenCamera. Create as
many as you like, of whatever variety you need. You can use the hierarchy view to reparent
externally-created vcams to the StateDrivenCamera, if you like, or just press the little + on the
camera list to create a standard one. When you do, those cameras will become available for
mapping. These virtual cameras will only be visible to the State-Driven Camera parent, and
will consume no processing resources until they are activated by the parent.
You will end up with something like this:
So now, when the states in the list become active, the associated child cameras will also
become active. They will blend in using the default blend setting defined in the
StateDrivenCamera. You can also create custom blends for specific pairs by creating a custom
blend asset on the StateDrivenCamera.
CinemachineStateDrivenCamera
This is a virtual camera “manager” that owns and manages a collection of child Virtual Cameras.
These child vcams are mapped to individual states in an animation state machine, allowing you
to associate specific vcams to specific animation states. When that state is active in the state
machine, then the associated camera will be activated.
You can define custom blends and transitions between child cameras.
In order to use this behaviour, you must have an animated target (i.e. an object animated with a
state machine) to drive the behaviour.
Look At Transform Default object for the camera children to look at (the aim target), if
not specified in a child camera. May be empty if all of the children
define targets of their own.
Follow Transform Default object for the camera children wants to move with (the
body target), if not specified in a child camera. May be empty if all
of the children define targets of their own.
Show Boolean When enabled, the current child camera and blend will be indicated
Debug in the game window, for debugging.
Text
Enable All Boolean Force all child cameras to be enabled. This is useful if animating
Child them in Timeline, but consumes extra resources.
Cameras
Animated Animator The state machine whose state changes will drive this camera’s
Target choice of active child.
Layer Int32 Which layer in the target state machine to observe.
Index
Instruction Instruction[] The set of instructions associating virtual cameras with states.
s These instructions are used to choose the live child at any given
moment.
Default CinemachineBl The blend which is used if you don’t explicitly define a blend
Blend endDefinition between two Virtual Camera children.
Custom CinemachineBl This is the asset which contains custom settings for specific child
Blends enderSettings blends.
Priority Int32 The priority will determine which camera becomes active based on
the state of other cameras and this camera. Higher numbers have
greater priority.
The Collider module can be added to any Cinemachine Virtual Camera (including complex
camera types such as FreeLook, State-Driven-Camera, and ClearShot). It does some or all of
several things:
● Pushes the camera out of intersecting obstacles in the scene.
● Puts the camera in front of obstacles that come between the camera and its LookAt
target.
● Evaluates shot quality (has the camera been moved away from where it wants to be?
does the camera have a clear view of its target? is the camera at a desirable distance
from its target?). This shot evaluation becomes part of the state information of the vcam,
and is available for use by modules that perform actions based on shot quality (see
ClearShot, for example).
● Gaussian smoothing of camera position.
The collider uses Physics Raycasts to do these things, hence obstacles in the scene must have
collider volumes in order to be visible to the CinemachineCollider. Furthermore, there is an
associated performance cost related to this. If your game is such that the cost of using physics
is prohibitive, then you might prefer to implement this functionality in a different way.
CinemachineCollider
An add-on module for Cinemachine Virtual Camera that post-processes the final position of the
virtual camera. Based on the supplied settings, the Collider will attempt to preserve the line of
sight with the LookAt target of the virtual camera by moving away from objects that will obstruct
the view.
Additionally, the Collider can be used to assess the shot quality and report this as a field in the
camera State.
Collide Against LayerMask The Unity layer mask against which the collider will raycast.
Minimum Distance Single Obstacles closer to the target than this will not be seen.
From Target
Avoid Obstacles Boolean When enabled, will attempt to resolve situations where the line
of sight to the target is blocked by an obstacle.
Distance Limit Single The maximum raycast distance when checking if the line of
sight to this camera’s target is clear. If the setting is 0 or less,
the current actual distance to target will be used.
Camera Radius Single Camera will try to maintain this distance from any obstacle.
Try to keep this value small. Increase it if you are seeing
inside obstacles due to a large FOV on the camera.
Strategy ResolutionSt The way in which the Collider will attempt to preserve sight of
rategy the target.
Possible Values:
- Pull Camera Forward: Camera will be pulled forward along
its Z axis until it is in front of the nearest obstacle.
- Preserve Camera Height: In addition to pulling the camera
forward, an effort will be made to return the camera to its
original height.
- Preserve Camera Distance: In addition to pulling the
camera forward, an effort will be made to return the camera to
its original distance from the target.
Maximum Effort Int32 Upper limit on how many obstacle hits to process. Higher
numbers may impact performance. In most environments, 4 is
enough.
Damping Single The gradualness of collision resolution. Higher numbers will
move the camera more gradually away from obstructions.
Optimal Target Single If greater than zero, a higher score will be given to shots when
Distance the target is closer to this distance. Set this to zero to disable
this feature.
CinemachineConfiner
An add-on module for Cinemachine Virtual Camera that post-processes the final position of the
virtual camera. It will confine the virtual camera’s position to the volume specified in the
Bounding Volume field.
This is less resource-intensive than CinemachineCollider, but it does not perform shot
evaluation.
Bounding Volume Collider The volume within which the camera is to be contained.
Damping Single How gradually to return the camera to the bounding volume
if it goes beyond the borders. Higher numbers are more
gradual.
CinemachineClearShot
Cinemachine ClearShot is a “manager camera” that owns and manages a set of Virtual Camera
GameObject children. When Live, the ClearShot will check the children, choose the one with the
best quality shot, and make it Live.
This can be a very powerful tool. If the child cameras have CinemachineCollider extensions,
they will analyze the scene for target obstructions, optimal target distance, and other items, and
report their assessment of shot quality back to the ClearShot parent, who will then choose the
best one. You can use this to set up complex multi-camera coverage of a scene, and be
assured that a clear shot of the target will always be available.
If multiple child cameras have the same shot quality, the one with the highest priority will be
chosen.
You can also define custom blends between the ClearShot children.
Look At Transform Default object for the camera children to look at (the aim target), if
not specified in a child camera. May be empty if all children
specify targets of their own.
Follow Transform Default object for the camera children wants to move with (the
body target), if not specified in a child camera. May be empty if all
children specify targets of their own.
Show Boolean When enabled, the current child camera and blend will be
Debug Text indicated in the game window, for debugging.
Activate Single Wait this many seconds before activating a new child camera.
After
Min Single An active camera must be active for at least this many seconds,
Duration unless a higher-priority camera wants to activate.
Randomize Boolean If checked, camera choice will be randomized if multiple cameras
Choice are equally desirable. Otherwise, child list order and child camera
priority will be used.
Default CinemachineBle The blend which is used if you don’t explicitly define a blend
Blend ndDefinition between two Virtual Cameras.
Priority Int32 The priority will determine which camera becomes active based
on the state of other cameras and this camera. Higher numbers
have greater priority.
Multiple Target Objects
If you have multiple LookAt targets and you want to keep them all in the frame, Cinemachine
can do this too. It’s a 2-step process:
1. Define a target group. This is a list of target objects, each with a weight and radius. The
weight says how important the group member is, and the radius is a rough indication of
its physical size.
2. Create a vcam with a GroupComposer, and assign the LookAt target to the target group.
The GroupComposer will make sure that all group members remain in the frame.
There is a shortcut in the Cinemachine menu to set this up and get you going.
CinemachineTargetGroup
Defines a group of target objects, each with a radius and a weight. The weight is used when
calculating the average position of the target group. Higher-weighted members of the group will
count more. The bounding box is calculated by taking the member positions, weight, and radii
into account.
Position Mode PositionMode How the group’s position is calculated. Select GroupCenter for
the center of the bounding box, and GroupAverage for a
weighted average of the positions of the members.
Possible Values:
- Group Center: Group position will be the center of the
group’s axis-aligned bounding box.
- Group Average: Group position will be the weighted average
of the positions of the members.
Rotation Mode RotationMode How the group’s rotation is calculated. Select Manual to use
the value in the group’s transform, and GroupAverage for a
weighted average of the orientations of the members.
Possible Values:
- Manual: Manually set in the group’s transform.
- Group Average: Weighted average of the orientation of its
members.
Update Method UpdateMethod When to update the group’s transform based on the positions
of the group members.
Possible Values:
- Update: Updated in normal MonoBehaviour Update.
- Fixed Update: Updated in sync with the Physics module, in
FixedUpdate.
- Late Update: Updated in MonoBehaviour LateUpdate.
Targets Target[] The target objects, together with their weights and radii, that
will contribute to the group’s average position, orientation, and
size.
[Link]
Holds the information that represents a member of the group.
Target Transform The target objects. This object’s position and orientation will
contribute to the group’s average position and orientation, in
accordance with its weight.
Weight Single How much weight to give the target when averaging. Cannot be
negative.
Radius Single The radius of the target, used for calculating the bounding box.
Cannot be negative.
CinemachineGroupComposer
This is a CinemachineComponent in the Aim section of the component pipeline. Its job is to aim
the camera at a target object, with configurable offsets, damping, and composition rules.
In addition, if the target is a CinemachineTargetGroup, the behaviour will adjust the FOV and
the camera distance to ensure that the entire group of targets is framed properly.
Group Framing SingleThe bounding box of the targets should occupy this amount
Size of the screen space. 1 means fill the whole screen. 0.5
means fill half the screen, etc.
Framing Mode FramingMode What screen dimensions to consider when framing. Can be
Horizontal, Vertical, or both.
Possible Values:
- Horizontal: Consider only the horizontal dimension. Vertical
framing is ignored.
- Vertical: Consider only the vertical dimension. Horizontal
framing is ignored.
- Horizontal And Vertical: The larger of the horizontal and
vertical dimensions will dominate, to get the best fit.
Frame Damping Single How aggressively the camera tries to frame the group. Small
numbers are more responsive, rapidly adjusting the camera
to keep the group in the frame. Larger numbers give a more
heavy slowly responding camera.
Adjustment AdjustmentMo How to adjust the camera to get the desired framing. You can
Mode de zoom, dolly in/out, or do both.
Possible Values:
- Zoom Only: Do not move the camera, only adjust the FOV.
- Dolly Only: Just move the camera, don’t change the FOV.
- Dolly Then Zoom: Move the camera as much as permitted
by the ranges, then adjust the FOV if necessary to make the
shot.
Max Dolly In Single The maximum distance toward the target that this behaviour
is allowed to move the camera.
Max Dolly Out Single The maximum distance away the target that this behaviour is
allowed to move the camera.
Minimum Single Set this to limit how close to the target the camera can get.
Distance
Maximum Single Set this to limit how far from the target the camera can get.
Distance
Minimum FOV Single If adjusting FOV, will not set the FOV lower than this.
Maximum FOV Single If adjusting FOV, will not set the FOV higher than this.
Minimum Ortho Single If adjusting Orthographic Size, will not set it lower than this.
Size
Maximum Ortho Single If adjusting Orthographic Size, will not set it higher than this.
Size
Tracked Object Vector3 Target offset from the target object’s center in target-local
Offset space. Use this to fine-tune the tracking target position when
the desired area is not the tracked object’s center.
Lookahead Time Single This setting will instruct the composer to adjust its target
offset based on the motion of the target. The composer will
look at a point where it estimates the target will be this many
seconds into the future. Note that this setting is sensitive to
noisy animation, and can amplify the noise, resulting in
undesirable camera jitter. If the camera jitters unacceptably
when the target is in motion, turn down this setting, or
animate the target more smoothly.
Horizontal Single How aggressively the camera tries to follow the target in the
Damping screen-horizontal direction. Small numbers are more
responsive, rapidly orienting the camera to keep the target in
the dead zone. Larger numbers give a more heavy slowly
responding camera. Using different vertical and horizontal
settings can yield a wide range of camera behaviors.
Vertical Damping Single How aggressively the camera tries to follow the target in the
screen-vertical direction. Small numbers are more
responsive, rapidly orienting the camera to keep the target in
the dead zone. Larger numbers give a more heavy slowly
responding camera. Using different vertical and horizontal
settings can yield a wide range of camera behaviors.
Screen X Single Horizontal screen position for target. The camera will rotate
to position the tracked object here.
Screen Y Single Vertical screen position for target, The camera will rotate to
position the tracked object here.
Dead Zone Width Single Camera will not rotate horizontally if the target is within this
range of the position.
Dead Zone Single Camera will not rotate vertically if the target is within this
Height range of the position.
Soft Zone Width Single When target is within this region, camera will gradually rotate
horizontally to re-align towards the desired position,
depending on the damping speed.
Soft Zone Height Single When target is within this region, camera will gradually rotate
vertically to re-align towards the desired position, depending
on the damping speed.
Bias X Single A non-zero bias will move the target position horizontally
away from the center of the soft zone.
Bias Y Single A non-zero bias will move the target position vertically away
from the center of the soft zone.
2D Environments
Cinemachine supports Orthographic cameras. When you set the Unity Camera’s style to
Orthographic, Cinemachine will adjust to accommodate it. FOV will be replaced by
Orthographic Size in the Lens settings. Note that settings related to FOV and certain
FOV-oriented behaviours such as FollowZoom will not have any effect if the camera is
orthographic.
In orthographic environments, it doesn’t usually make sense to rotate the camera. Accordingly,
Cinemachine has a special transposer that handles framing and composition without rotating
the camera.
CinemachineFramingTransposer
This is a Cinemachine Component in the Body section of the component pipeline. Its job is to
position the camera in a fixed screen-space relationship to the vcam’s Follow target object, with
offsets and damping.
The camera will be first moved along the camera Z axis until the Follow target is at the desired
distance from the camera’s X-Y plane. The camera will then be moved in its XY plane until the
Follow target is at the desired point on the camera’s screen.
The FramingTansposer will only change the camera’s position in space. It will not re-orient or
otherwise aim the camera.
For this component to work properly, the vcam's LookAt target must be null.
If the Follow target is a CinemachineTargetGroup, then additional controls will be available to
dynamically adjust the camera’s view in order to frame the entire group.
Although this component was designed for orthographic cameras, it works equally well with
persective cameras and can be used in 3D environments.
X Damping Single How aggressively the camera tries to maintain the offset in the X-axis.
Small numbers are more responsive, rapidly translating the camera to
keep the target’s x-axis offset. Larger numbers give a more heavy
slowly responding camera. Using different settings per axis can yield a
wide range of camera behaviors.
Y Damping Single How aggressively the camera tries to maintain the offset in the Y-axis.
Small numbers are more responsive, rapidly translating the camera to
keep the target’s y-axis offset. Larger numbers give a more heavy
slowly responding camera. Using different settings per axis can yield a
wide range of camera behaviors.
Z Damping Single How aggressively the camera tries to maintain the offset in the Z-axis.
Small numbers are more responsive, rapidly translating the camera to
keep the target’s z-axis offset. Larger numbers give a more heavy
slowly responding camera. Using different settings per axis can yield a
wide range of camera behaviors.
Screen X Single Horizontal screen position for target. The camera will move to position
the tracked object here.
Screen Y Single Vertical screen position for target, The camera will move to position
the tracked object here.
Camera Single The distance along the camera axis that will be maintained from the
Distance Follow target.
Dead Zone Single Camera will not move horizontally if the target is within this range of
Width the position.
Dead Zone Single Camera will not move vertically if the target is within this range of the
Height position.
Dead Zone Single The camera will not move along its z-axis if the Follow target is within
Depth this distance of the specified camera distance.
Unlimited Boolean If checked, then then soft zone will be unlimited in size.
Soft Zone
Soft Zone When target is within this region, camera will gradually move
Single
Width horizontally to re-align towards the desired position, depending on the
damping speed.
Soft Zone Single When target is within this region, camera will gradually move vertically
Height to re-align towards the desired position, depending on the damping
speed.
Bias X Single A non-zero bias will move the target position horizontally away from
the center of the soft zone.
Bias Y Single A non-zero bias will move the target position vertically away from the
center of the soft zone.
Group FramingM What screen dimensions to consider when framing. Can be Horizontal,
Framing ode Vertical, or both.
Mode Possible Values:
- Horizontal: Consider only the horizontal dimension. Vertical framing
is ignored.
- Vertical: Consider only the vertical dimension. Horizontal framing is
ignored.
- Horizontal And Vertical: The larger of the horizontal and vertical
dimensions will dominate, to get the best fit.
- None: Don’t do any framing adjustment.
Adjustment Adjustmen How to adjust the camera to get the desired framing. You can zoom,
Mode tMode dolly in/out, or do both.
Possible Values:
- Zoom Only: Do not move the camera, only adjust the FOV.
- Dolly Only: Just move the camera, don’t change the FOV.
- Dolly Then Zoom: Move the camera as much as permitted by the
ranges, then adjust the FOV if necessary to make the shot.
Group Single The bounding box of the targets should occupy this amount of the
Framing Size screen space. 1 means fill the whole screen. 0.5 means fill half the
screen, etc.
Max Dolly In Single The maximum distance toward the target that this behaviour is allowed
to move the camera.
Max Dolly Single The maximum distance away the target that this behaviour is allowed
Out to move the camera.
Minimum Single Set this to limit how close to the target the camera can get.
Distance
Maximum Single Set this to limit how far from the target the camera can get.
Distance
Minimum Single If adjusting FOV, will not set the FOV lower than this.
FOV
Maximum Single If adjusting FOV, will not set the FOV higher than this.
FOV
Minimum Single If adjusting Orthographic Size, will not set it lower than this.
Ortho Size
Maximum Single If adjusting Orthographic Size, will not set it higher than this.
Ortho Size
Post-Processing Stack V1
If you have Unity’s Post-Processing Stack as an asset in your project (and if you don’t, you
should, because this is an amazing tool that gives world-class results), you can easily assign
custom post-effects to any shot in your scene, even though it’s a virtual camera and not a real
one.
This section describes the use of Post Processing stack V1. If you have Post Processing V2,
see the section below.
Just define a Post-Processing profile for your vcam, and connect it by attaching a
CinemachinePostFX component to your vcam. To complete the connection, you will also need
a CinemachinePostFX component on the Unity camera, alongside the CinemachineBrain.
That’s all you have to do. Now, whenever the vcam is activated, its custom Post-Processing
profile will be applied to the Unity camera.
CinemachinePostFX
This behaviour is a liaison between Cinemachine with the Post-Processing module. You must
have the Post-Processing Stack unity package installed in order to use this behaviour.
● As a component on the Unity Camera: it serves as the liaison between the camera’s
CinemachineBrain and the camera’s Post-Processing behaviour. It listens for camera Cut
events and resets the Post-Processing stack when they occur. If you are using
Post-Processing, then you should add this behaviour to your camera alongside the
CinemachineBrain, always.
● As a component on the Virtual Camera: In this capacity, it holds a Post-Processing Profile
asset that will be applied to the camera whenever the Virtual camera is live. It also has
the (temporary) optional functionality of animating the Focus Distance and DepthOfField
properties of the Camera State, and applying them to the current Post-Processing profile.
Profile PostProcessingProfile When this behaviour is on a Unity Camera, this setting
is the default Post-Processing profile for the camera,
and will be applied whenever it is not overridden by a
virtual camera. When the behaviour is on a virtual
camera, then this is the Post-Processing profile that
will become active whenever this virtual camera is
live.
Focus Tracks Boolean If checked, then the Focus Distance will be set to the
Target distance between the camera and the LookAt target.
Focus Offset Single Offset from target distance, to be used with Focus
Tracks Target.
Post Processing Stack V2
Just define a Post-Processing profile for your vcam, and connect it by attaching a
CinemachinePostProcessing extension to your vcam. To complete the connection, you will
also need a PostProcessingLayer component on the Unity camera, alongside the
CinemachineBrain. Make sure that the PostProcessingLayer is configured to see the layer that
the vcams are on.
That’s all you have to do. Now, whenever the vcam is activated, its custom Post-Processing
profile will be applied to the Unity camera. If the camera is blending with another vcam, then the
blend weight will be applied to the Post Processing effects also.
CinemachinePostProcessing
This behaviour is a liaison between Cinemachine with the Post-Processing V2 module. You
must have the Post-Processing Stack V2 unity package installed in order to use this behaviour.
As a component on the Virtual Camera, it holds a Post-Processing Profile asset that will be
applied to the camera whenever the Virtual camera is live. It also has the optional functionality
of animating the Focus Distance and DepthOfField properties of the Camera State, and
applying them to the current Post-Processing profile.
Profile PostProcessingProfile When this behaviour is on a Unity Camera, this setting
is the default Post-Processing profile for the camera,
and will be applied whenever it is not overridden by a
virtual camera. When the behaviour is on a virtual
camera, then this is the Post-Processing profile that
will become active whenever this virtual camera is
live.
Focus Tracks Boolean If checked, then the Focus Distance will be set to the
Target distance between the camera and the LookAt target.
Focus Offset Single Offset from target distance, to be used with Focus
Tracks Target.
And the Rest
CinemachineFollowZoom
An add-on module for Cinemachine Virtual Camera that adjusts the FOV of the lens to keep the
target object at a constant size on the screen, regardless of camera and target position.
Width Single The shot width to maintain, in world units, at target distance.
Damping Single Increase this value to soften the aggressiveness of the
follow-zoom. Small numbers are more responsive, larger numbers
give a more heavy slowly responding camera.
Min FOV Single Lower limit for the FOV that this behaviour will generate.
Max FOV Single Upper limit for the FOV that this behaviour will generate.
CinemachineDollyCart
This is a very simple behaviour that constrains its transform to a CinemachinePath. It can be
used to animate any objects along a path, or as a Follow target for Cinemachine Virtual
Cameras.
CinemachineMixingCamera
CinemachineMixingCamera is a “manager camera” that takes on the state of the weighted
average of the states of its child virtual cameras.
A fixed number of slots are made available for cameras, rather than a dynamic array. We do it
this way in order to support weight animation from the Timeline. Timeline cannot animate array
elements.
CinemachineExternalCamera
This component will expose a non-Cinemachine camera to the Cinemachine system, allowing it
to participate in blends. Just add it as a component alongside an existing Unity Camera
component.
Priority Int32 The priority will determine which camera becomes active based on
the state of other cameras and this camera. Higher numbers have
greater priority.
SaveDuringPlay
Cameras need to be tweaked in context - often that means while the game is playing. Normally,
Unity does not propagate those changes to the scene once play mode is exited. Cinemachine
has implemented a special feature to preserve parameter tweaks made during game play. It
won’t save structural changes (like adding or removing a behaviour), but it will keep the tweaks.
Cinemachine behaviours have a special attribute [SaveDuringPlay] to enable this functionality.
Feel free to use it on your own scripts too if you need it.
It works by scanning the scene after Play exits and applying any changed parameters back to
the scene. This kicks in a second or so after exit. You can always hit Undo to revert the
changes.
If there are specific settings within a behaviour that you want to exclude from Play-Mode save,
you can add the [NoSaveDuringPlay] attribute to them, and they will be skipped.
This feature can be enabled by checking the Save During Play checkbox on any Virtual
Camera inspector. This is a static global setting, not per-camera, so you only need to check it
once.
Timeline Integration
1. Drag a Cinemachine-enabled Unity camera (i.e. one with a CinemachineBrain
component) onto the timeline, select Create Cinemachine Track from the popup menu.
2. The Cinemachine track is an enable/disable style track, which means that the clips will
enable Cinemachine Virtual Cameras while they are active in the timeline.
3. Overlapping Cinemachine Shot Clips will produce blends.
4. Create a Cinemachine shot by right-clicking on the Cinemachine Track and selecting
Create Cinemachine Shot Clip.
5. Drag a virtual camera from the scene onto the Cinemachine Shot Clip inspector. That
will associate the shot clip with the virtual camera.
6. The virtual camera does not need to be enabled in the scene. While the clip is active in
the timeline, that camera will become enabled.
The following slides will serve as a brief introduction to get you started.
Special Environments
Top-Down Games
Cinemachine Virtual Cameras are modeled after human camera operators. As such, they have
a sensitivity to the up/down axis, and will always try to avoid introducing roll into the camera
framing - unless you deliberately introduce it via such settings as dutch. Because of this
sensitivity, virtual cameras do not like to look straight up or down for extended periods. They
will do it in passing, but if the LookAt target is often straight up or down, they will not always give
the desired results.
If you are building a top-down game, the best practice is to redefine the up direction, for the
purposes of the camera. You do this by setting the World Up Override in the
CinemachineBrain to a game object whose local up points in the direction that you want the
Camera’s up to normally be. This will be applied to all virtual cameras connected to that brain.
Split-screen
You can set up a multi-camera split-screen with Cinemachine 2.0:
1. Make 2 Unity Cameras, give each one its own CinemachineBrain, and set up their
viewports.
2. Now make 2 virtual cameras to follow the players. Assign those virtual cameras to
different layers. We’ll call them layer A and layer B.
3. Go back to the two Unity cameras, and set their culling masks so that one camera sees
layer A but not layer B, and the other camera does the opposite.
4. That’s it! Camera A will be driven by virtual cameras on layer A, and camera B will be
driven by virtual cameras on layer B. They will do their blending etc independently.
5. Add as many layers and cameras as you like.
Scripting
Cinemachine is a pure-csharp implementation and is completely accessible to scripting. All of
the settings visible in the inspector have corresponding fields in the csharp classes. In addition
there is a full scripting API which you can discover either by examining the well-commented
sources in the implementation, or by looking at the scripting scene in the examples, or by
consulting the API documentation shipped with Cinemachine and available online.