Cinemachine: Keeping All Objects In View in Unity
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.
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.
The Radius determines, at a minimum, the distance between the camera and that object.
The image below shows two objects Radius values being increased.
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.