Third Person Camera with Cinemachine Free Look

Create a camera that follows your player and avoids obstacles

4 min read 90K+ views Jun 8, 2021
What You'll Learn

This tutorial shows you how to set up a third-person camera using Cinemachine's Free Look camera that follows your player, allows mouse-controlled rotation, and automatically avoids obstacles.

1 Install Cinemachine

First, make sure Cinemachine is installed in your project:

  1. Go to Window → Package Manager
  2. Select Unity Registry from the dropdown
  3. Search for Cinemachine
  4. Click Install

2 Add a Free Look Camera

  1. In the Hierarchy, go to Cinemachine → Free Look Camera
  2. A new CM FreeLook object will be created

3 Configure Follow Target

  1. Select the CM FreeLook camera
  2. In the Inspector, find the Follow field
  3. Drag your Player object into the Follow field

The camera will now follow your player's position.

4 Set Up Look At Target

By default, looking at the player centers on their feet. To fix this:

  1. Create an empty GameObject as a child of your player
  2. Name it "LookAt"
  3. Position it at the center of your character (e.g., Y = 2)
  4. Drag this LookAt object into the camera's Look At field
Why Use a Separate Look At?

Using a dedicated LookAt object gives you precise control over where the camera focuses, without being tied to the player's pivot point.

5 Configure the Orbits

The Free Look camera has three orbital rigs: Top, Middle, and Bottom. Configure each one:

Rig Height Radius
Top Rig 7 (adjust to taste)
Middle Rig 5 (adjust to taste)
Bottom Rig 4 (adjust to taste)

As you move the mouse up/down, the camera transitions between these rigs.

6 Adjust Input Settings

Invert Y-Axis (Optional)

If your vertical camera control feels backwards:

  1. Find the Y Axis settings in the Inspector
  2. Check the Invert checkbox

Binding Mode

To prevent the camera from rotating with your player:

  1. Find Binding Mode in the Orbits section
  2. Change it from "Simple Follow With World Up" to World Space

7 Add Obstacle Avoidance

To prevent objects from blocking the camera view:

  1. Select the CM FreeLook camera
  2. Scroll down to Extensions
  3. Click Add Extension
  4. Select Cinemachine Collider

Collider Settings

Setting Value Description
Minimum Distance From Target 1 Prevents camera from going past the character
Strategy Pull Camera Forward Zooms in when obstacles are detected
Strategy Options

Pull Camera Forward zooms the camera closer when obstacles block the view. Other strategies include ray-casting techniques for different behaviors.

8 Smooth Camera Movement (Optional)

For smoother obstacle avoidance (less snappy transitions):

  1. In the Cinemachine Collider extension
  2. Adjust Damping (e.g., 0.5)
  3. Adjust Damping When Occluded (e.g., 0.5)
Trade-off

Higher damping values create smoother camera movement but may cause brief clipping through objects. Find a balance that works for your game.

Final Result

Your camera now:

  • Follows the player smoothly
  • Rotates with mouse input
  • Automatically avoids obstacles
  • Zooms in when near walls or objects

Quick Reference Settings

CM FreeLook Camera Settings: ├── Follow: [Your Player] ├── Look At: [LookAt Empty Object] ├── Orbits │ ├── Binding Mode: World Space │ ├── Top Rig Height: 7 │ ├── Middle Rig Height: 5 │ └── Bottom Rig Height: 4 ├── Y Axis │ └── Invert: true (optional) └── Extensions └── Cinemachine Collider ├── Min Distance From Target: 1 ├── Strategy: Pull Camera Forward ├── Damping: 0.5 └── Damping When Occluded: 0.5