Creating a Virtual Camera

Eric Veciana
4 min readMay 4, 2023

Objective: Learn the basics of the Virtual Camera

The virtual camera is going to be the most commonly used. The extra cinemachine camera options within Unity are mostly going to be a virtual camera with extra elements attached to it. For this reason, it is important we have a good understanding of the virtual camera.

A virtual camera is a placeholder camera that the main camera adheres to and follows. If the Virtual Camera is the camera that is playing in the scene, the main camera will adhere to this new virtual camera and follow it. It’s important to know that a virtual camera is not an actual camera, it simply attaches to the main camera.

Let’s go ahead and create our first virtual camera.

In order to know if our Main Camera is working, we need to have the Cinemachine Brain attached to it. This happens automatically when you add your first virtual camera into the scene. You will also see the Cinemachine Brain icon next to the Main Camera in the hierarchy.

The cinemachine brain will essentially look for virtual cameras within our scene.

One “trick” you can do to automatically line up your virtual camera with the object you placed, so you don’t have to manually align it, is select “Align With View.

So, you will double click the object that you are trying to align it with, and then simply select your camera and then “Align With View” or use CTRL + Shift + F.

Next, I am going to review the elements of a virtual camera so we can have a good understanding of it.

First, Let’s discuss the Solo button. This is helpful when we have multiple virtual cameras in our scene and we want to single out that camera. When clicking the solo button, you will notice below that it switches between cameras.

The Game Window Guide is useful when you have something you want the camera to target or look at. Simply have this option selected, and drag the object that you want it to look at within the Look At section.

Save During Play is essentially that. If you are in play mode, and you make edits to your camera, you are making sure these settings will be saved when exiting play mode.

The Priority is very useful and will be used often. This is useful when we have multiple cameras in our scene and we want Unity to know which camera to prioritize based on the state of other cameras and this current camera. The higher numbers have greater priority.

Priority

We will go into Follow and Look At a bit deeper in the near future, but basically Follow chooses what object the camera will follow position-wise and Look At chooses which object to Target.

The Lens has several options. The Lens Vertical POV adjusts the focal length and how close or far we are from the object.
The Near Clip Plane adjusts where objects will start dropping off. You will see this in First Person Shooter games when the player gets really close to an object and the weapon gets cut off. This is due to a high value in the clipping plane.
The Dutch is the way you pitch your angle. We use the Dutch to add an effect of foreboding or fear to the player.

Lens

The Transitions allows us to choose the how we want to transition between our different cameras, which we will discuss further later.

Body and Aim will be discussed later.

Extensions allows us to include some extra options onto our camera. It is important to note that the Extensions occur AFTER everything else in our camera has taken effect.

These are the basics of the virtual camera and are important to understand before moving forward.

--

--