Cinemachine: Keeping All Objects In View in Unity

Ryan McCoach
3 min readAug 24, 2022

--

Intro

In this article, we are going to cover Cinemachine’s Target Group camera. According to Unity’s documentation, the Target Group camera, “…treat[s] multiple GameObjects as a single Look At target.” This basically means it will track all of the objects that are part of the group and adjust the camera to make sure they all remain in view.

Target Group Camera

In the Cinemachine window, select Create Target Group Camera.

This will create a Target Group and a Virtual Camera. The Target Group is not the camera, but the script that calculates the positioning of the Virtual Camera it is controlling.

Add the amount of objects you will want in the Target Group and assign the objects to the list.

Weight

The Weight determines the importance of the object in the group. The higher the weight, the more the camera will focus on that object compared to the others.

The image above shows two object’s Weight being increased over the others.

Radius

The Radius determines, at a minimum, the distance between the camera and that object.

The image below shows two objects Radius values being increased.

Other Settings

Position Mode — just determines how the positioning is calculated

Rotation Mode — is how the rotation of the group will be calculated.

Update mode — Determines what type of update the calculations will use.

Below is the link to the documentation that will give you more information on these settings.

https://docs.unity3d.com/Packages/com.unity.cinemachine@2.8/manual/CinemachineTargetGroup.html

--

--

No responses yet