Camera and Cinemachine
First/third-person views, virtual cameras and smooth follow without the math.
The Camera component
A camera in Unity is an ordinary GameObject with a Camera component. The main fields:
- Projection —
Perspective(3D, with perspective) orOrthographic(no perspective; 2D/isometric). - FOV (Field of View) — the vertical field of view in degrees. The standard for FPS is 60–90°.
- Clipping Planes: Near / Far — the distance to the near and far clipping planes. Anything
closer than Near or farther than Far is not drawn. A large spread (for example, 0.01 ↔ 10000)
degrades Z-buffer precision and leads to “Z-fighting” — flickering intersections. Try to keep
Far/Near < ~10000. - Culling Mask — which object layers this camera draws.
- Target Texture — render the picture not to the screen, but to a texture (minimaps, portal effects).
- Depth — the draw order of multiple cameras.
// A simple follow camera in LateUpdate
public class SimpleFollow : MonoBehaviour
{
[SerializeField] private Transform target;
[SerializeField] private Vector3 offset = new Vector3(0, 2f, -4f);
[SerializeField] private float smoothTime = 0.15f;
private Vector3 _velocity;
private void LateUpdate() {
Vector3 desired = target.position + target.rotation * offset;
transform.position = Vector3.SmoothDamp(transform.position, desired, ref _velocity, smoothTime);
transform.LookAt(target.position + Vector3.up * 1.5f);
}
}
Vector3.SmoothDamp is a critically convenient function: it smooths movement with spring mechanics,
without overshooting the target position. It stores the “velocity” in an external variable.
If you move the camera in Update, it may catch up to the target one frame later. LateUpdate
guarantees that the target has already moved this frame.
Cinemachine — follow a target without pain
Cinemachine is a UPM package (preinstalled in the standard Unity 6 templates, but still installed via the Package Manager) with virtual cameras. The idea: there is one real Camera in the scene, and Cinemachine dynamically switches it between different virtual viewpoints. Without any scripts you can assemble:
- Follow — follow an object with delay and damping.
- Look At — look at an object, smoothly turning toward it.
- FreeLook — an orbital camera with three rings (third-person, like in Dark Souls).
- Cart/Dolly — movement along a spline.
- State-Driven Camera — switching virtual cameras based on the Animator state.
A basic follow camera in Cinemachine 3.x
Unity 6 ships with Cinemachine 3, whose API differs noticeably from 2.x:
- Add a CinemachineCamera to the scene (formerly
CmCamera/CinemachineVirtualCamera). - In the “Tracking Target” field, specify the player’s Transform.
- On the virtual camera, add stage components (subclasses of
CinemachineComponentBase):CinemachineFollow(formerly Body) andCinemachineHardLookAt/CinemachineRotationComposer(formerly Aim). This is a separate category, not the same as Cinemachine Extensions (Impulse Listener, Deoccluder, etc.).
A single CinemachineBrain on the main Camera automatically blends between the active virtual cameras
by priority. Want to switch the view? vcam.Priority = 100; — and the Brain will smoothly move there
over the configured blend time.
public class CameraSwitcher : MonoBehaviour
{
[SerializeField] private Unity.Cinemachine.CinemachineCamera firstPerson;
[SerializeField] private Unity.Cinemachine.CinemachineCamera thirdPerson;
public void SwitchToFP() {
firstPerson.Priority = 20;
thirdPerson.Priority = 10;
}
}
If you are reading old tutorials — they have a CinemachineVirtualCamera with Body and Aim
sections. In Unity 6 this is a CinemachineCamera with separate extension components. The concept
is the same, the names are different.
The main advice about the camera
The camera is a director, not an intern operator.
The best camera is the one the player does not notice. Add smoothness (smooth follow), enough field of view so the target does not run into the edge of the screen, and don’t let the camera jump on the character’s sharp turns. Cinemachine already accounts for most of these cases for you — use it.
In the next chapter — rendering: how Unity actually draws pixels.