Skip to content

Unity Cinemachine Tutorial: Complete Guide To Setup Better Game Cameras

Creating a great looking game camera that looks smooth and cinematic can be very hard to accomplish in a unity game. Cinemachine is an amazing tool that can help you achieve all of these goals. Cinemachine allows you to dictate how a camera will move in a game. It will allow you to move your camera, follow objects and do much more with your game’s camera.

Unity Cinemachine can be used for almost any type of game that uses a camera. Third person games, platformer games, racing games and more can use cinemachine to improve their game cameras.

What Is Unity Cinemachine?

As previously mentioned Unity Cinemachine is used to create camera’s in your game. There are many different things you can add to your camera using cinemachine to make it look better.

Normally if you were using just a camera in unity you would have to create scripts to tell the camera how far away from your object it should be and what way it should rotate. You can do all of this with cinemachine by using their components.

There are many components that you can use to improve your camera when using cinemachine.

Why Use Cinemachine in Unity?

Your game camera plays a big role in how your game feels to play. No matter how good your game may be if your camera doesn’t feel right it will feel bad to play.

By using Cinemachine you are able to get your camera up and running quicker then you would if you were using only your own scripts.

  • Here are some things you can use cinemachine for:
  • Getting a smooth camera
  • Having your camera follow the player
  • Have your camera look at certain objects
  • Have multiple camera’s
  • Make your camera look cinematic
  • Blend between camera’s
  • Control how your camera dampens
  • Improve your camera in your game
  • Can be used for gameplay and cinematic camera’s

You will find that when creating a game that requires multiple cameras Cinemachine will be a lifesaver.

How to Install Cinemachine in Unity

To install Cinemachine you will need to go to your package manager in unity.

Go to Window > Package Manager. From here you will see different packages you can install. Look for Cinemachine and install it.

Once installed you will be able to add cinemachine to your project and start improving your camera’s.

Depending on your version of unity the steps may be slightly different. As cinemachine has updated there are many new changes that you should know about.

Make sure you are using a tutorial that corresponds to your version of unity and cinemachine.

Creating a Cinemachine Camera

Now that you have Cinemachine installed you can start adding Cinemachine camera’s to your game.

By default Cinemachine will take care of how you want your game camera to act and you will use your normal camera to display it on the screen.

You will have one main camera and then your cinemachine camera(s). You can have as many camera’s as you want that use cinemachine. You can set your camera to follow or look at any gameobject you want.

For example if you were making a third person game you would want your camera to follow the player. You can set your cinemachine camera to follow your player.

Using Cinemachine to Follow the Player

As shown above you can set your camera to follow any gameobject you want. Most likely you will want your camera to follow your player in your game.

When making a third person game you will want your camera to be behind your player and follow them as they move around. You can set a target for your camera and then adjust how your camera will act around that target.

You want to make sure you have some damping on your camera. If your camera isn’t smoothed out it will jump towards your player when they move.

There is no magic number to how you should have your damping. You will want to test and see what feels best to you.

Creating Smooth Camera Movement

You want to make sure your camera looks smooth when following your player. You don’t want your camera to look jerky when your player is moving.

If your player walks forward you want your camera to slowly travel in front of them instead of just jumping in front of them.

You don’t want to over do your damping either. Your camera shouldn’t feel sluggish when following your player.

Find the right balance for your camera depending on how your game moves.

Cinemachine Camera Rotation

Just like following your player you can also make your camera rotate around your player. This can be done by adding more cinemachine components to your camera.

You can make your camera rotate around your player for a third person game or keep it in front of your car for a racing game.

You can add as many cinemachine components as you want to your camera to get the feel that you are looking for.

Using Multiple Cinemachine Cameras

You can use as many camera’s that you want in your game. Each one can have different properties applied to them to give you that cinematic look.

  • For example your game may have:
  • Gameplay camera (third person)
  • Close up camera when doing a special attack
  • Cinematic camera when something big happens
  • Camera when entering a building
  • Cut scene camera
  • Special camera for fighting a boss

You can have as many camera’s as you want and switch between them when needed.

This is what makes Cinemachine so powerful when creating camera’s in your game.

Cinemachine Camera Blending

You can also blend your camera’s together when switching between camera positions. When switching camera’s you can have your camera blend into the new position instead of instantly jumping there.

For example if your player was walking through a door you can have your camera blend into a cinematic camera.

You can adjust how long your camera will take to blend into the next position. You may want your camera to blend quickly if your gameplay is fast or slow down for cinematic moments.

Cinemachine for Cutscenes

Cinemachine can also be used to create cut scenes in your game. By placing camera’s at different points and animating them you can create cinematic camera’s in your game.

You can use Cinemachine along with Unity Timelines to create cut scenes.

Maybe your cut scene starts off by showing your environment then zooms in on your character. Then you can switch to your gameplay camera.

There are many things you can do with cinemachine when making cut scenes.

Using Cinemachine in Third-person Games

Many games that have a third person camera can benefit from using Cinemachine. As mentioned before you want your camera to follow your player. But you also want to be able to rotate your camera with your mouse or controller.

Cinemachine can do all of this for you. You will want to make sure your camera feels comfortable to use.

You can also have your camera stay a certain height or not rotate above a certain point. Make sure your camera feels right when playing your game.

Cinemachine for 2d Games

You can also use Cinemachine for 2d games. If you have a 2d platformer you will want your camera to follow your player and not show to much of your map.

You can have your camera follow your player and keep them in a certain spot on your screen.

You can use Cinemachine to make sure your camera doesn’t go outside of your map when creating a 2d game.

This is helpful if you are making a 2d platformer or any other 2d game that uses a camera.

Improving Camera Performance and Feel

Once you have your camera setup you want to make sure it feels good to play. Test out your camera while playing your game and make sure everything feels smooth.

Below is a table summarizing key aspects to improve camera performance and feel using Unity Cinemachine.

 

Aspect Key Focus Action Needed Result
Player Tracking Correct target Assign player as target Smooth following
Smoothness Damping settings Adjust damping values Eliminate jerky movements
Responsiveness Test camera Playtest camera controls Natural camera flow
Collision Handling Environmental obstacles Enable collision avoidance No clipping through objects
Testing Iterative adjustment Frequent tests during gameplay Balanced camera performance

With these adjustments in mind, let’s address some common Cinemachine problems you might encounter.

There is nothing worse then a game that has a bad camera. You want to make sure your camera feels good when your player is running and jumping around.

Test your camera out and adjust until it feels right for your game.

Common Cinemachine Problems

When first starting out with Cinemachine you may run into some problems. Here are some common problems people run into.

Not having the correct target on your camera. Make sure your camera is set to follow your player or whatever you want it to follow.

Having your damping too high or too low. You want your camera to feel smooth but not sluggish.

Using cinemachine with other scripts that are moving your camera. You want to make sure your camera is only being moved by one thing.

Using an old tutorial that may not match your version of unity.

Also check:

Frequently Asked Questions

1. What is Cinemachine in Unity?
Unity Cinemachine is a camera system that helps you create and control game cameras without writing extensive custom camera scripts. It can handle camera following, rotation, damping, blending, framing, and cinematic camera movements.

2. How do I install Cinemachine in Unity?
You can install Cinemachine through Unity’s Package Manager. Open Window → Package Manager, search for Cinemachine, and install the package. The exact interface and available features can vary between Unity and Cinemachine versions.

3. Can Cinemachine be used for third-person games?
Yes. Cinemachine is commonly used for third-person cameras. You can set the player as the camera’s target and configure the camera’s position, rotation, damping, and other settings to create smooth third-person movement.

4. Can I use Cinemachine for 2D games?
Yes. Cinemachine can be used for 2D games such as platformers. You can make the camera follow the player, control how the player is positioned on the screen, and keep the camera within the boundaries of your level.

5. Can Cinemachine be used for cutscenes?
Yes. You can use multiple Cinemachine cameras with Unity Timeline to create cutscenes. Different cameras can be positioned around your scene and blended together to create smooth camera transitions and cinematic sequences.

One SEO improvement

Your article has good coverage, but I would also add a short section called:

## Unity Cinemachine Best Practices

You could cover:

  • Use appropriate damping rather than excessive damping.
  • Avoid having multiple scripts control the same camera.
  • Test camera movement during actual gameplay.
  • Keep the camera within level boundaries.
  • Use different Cinemachine cameras for gameplay and cinematic moments.
  • Make sure your tutorial matches your Unity/Cinemachine version.

Leave a Reply

Your email address will not be published. Required fields are marked *