Aiming Features in Cinemachine

Objective: To look into the aiming features of the virtual camera in Cinemachine in Unity.

When you first create your new virtual camera, there will automatically be a new CinemachineVirtualCamera component attached to the game object. Within this component, and beneath the Lens Settings, we get a first look at our ‘Aimfeatures for the camera and the many fields we can play around with to get the camera setup exactly how we want. Let’s take a quick look into these settings!

CinemachineVirtualCamera Component

Aim Feature in CinemachineVirtualCamera Component

Within ‘Aim’ we are presented with a drop down box with 3 optionsHard Constraint, Composer and Group Composer, let’s discuss these:

Aim Drop Down Box Options

Hard Constraint

Hard Constraint essentially removes all the other settings that we can adjust and simply keeps the ‘LookAttarget in the dead centre of the camera.

Hard Constraint — Aim Feature

Let’s take a quick look at the Hard Constraint Aim feature in action:

Hard Constraint Aim Feature — No Adjustment Boxes Available/Dead Centre of Camera

As you can see the camera is stuck to the LookAt target in the centre of the screen the whole time, and all of adjustment boxes have been removed. As you will now see below with the Composer option, the camera will have offsets and dead/soft zones.

Composer

The Composer is similar to the Hard Constraint in the way that the LookAt target is in the middle of the camera however, it doesn’t necessarily need to be dead centre and often uses offsets, damping, dead zones and soft zones to move the camera around.

Composer — Aim Feature

Let’s take a quick look at the Composer feature in action:

Composer Feature — Adjustable Boxes

Damping refers to how aggressively the camera is going to follow the target, the lower the number the more responsive the camera will be and the higher numbers will mean it reacts more slowly. This can be adjusted on both the horizontal and vertical axis.

The Dead Zone is the middle grey box in the centre of the screen. If the target is within this zone, the camera will not move.

The Soft Zone is the red area on the screen and it means that when the target is within this zone, the camera will rotate towards the desired position depending on the damping settings as discussed above.

Group Constraint

Group Constraint aims the camera at multiple game objects in the frame. and we are presented with more additional settings to play around with, along with an error that let’s us know that the “LookAt target must be a Cinemachine TargetGroup”.

Group Constraint — Aim Feature

To fix this error, let’s add a Target Group to the LookAt box. We can complete this by going to Cinemachine tab → Create Group Target Camera. This will create a new virtual camera, along with a target group that already has been assigned to both the ‘LookAt’ and ‘Follow fields. We can also use this TargetGroup to be assigned to our original virtual camera, and we can delete the new virtual camera created.

The TargetGroup will now have a script component attached to it called ‘CinemachineTargetGroup’ and this is where you can add game objects as ‘targets’ and adjust the weighting and radius of each.

--

--

--

Passionate Unity Game Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Challenge #5: Optimize an Algorithm

Flutter Web: Twitch OAuth2 authentication flow implementation

Start writing SQL queries — Part II

Smash the stack.

Abstraction is not vague, it is a specific behaviour to expose

Solve CRM to HubSpot CRM: Turn Your Business Success into Reality — Data2CRM

What is an env file and how to use an env file in PHP?

.env file in php

The (non) importance of health-checks in your code

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chris Hilton

Chris Hilton

Passionate Unity Game Developer

More from Medium

Transposer Virtual Camera Explained in Unity’s Cinemachine

IK Weapon System in Unity

2D Mobile: Loot System

What are Unity Skyboxes?