2D Cameras Using Virtual Cameras!

addam davis
3 min readMar 2, 2023

Objective: Create 2D camera using Cinemachine!

To create a 2D camera using Cinemachine, all you need to do is, go to Cinemachine and select “Create 2D Camera”

Once created you can ‘solo’ the camera and adjust it to fit your scene. If you want to go FULL 2D then you are going to have to change the projection from perspective to Orthographic.

This will create the true 2D look and you’ll notice that the floor disappeared. That’s because the floor is flat, you will need to pitch it to see it.

To create a quick floor, create a cube. Stretch the cube to fill out your scene.

On the camera you are going to want to follow the player so set the player to the follow object.

Now when you play the editor your camera will follow the player as they move.

Another thing that is commonly used in the 2D environment is the ability to put a constrainer on the camera. That way, if the player gets to the edge of the walkway, you’ll never see the edge of the walkway.

To do this you will want to add a game object. Create a cube. Stretch the cube to the appropriate size and place it over the camera.

One the camera we will need to add the extension “Confiner” The box we are using is a 3D object so we will need the confiner to be set to 3D and assign the box to the inspector.

Now you can play the editor and test your camera to see how far it can go. If you see the edge of the scene, then you will need to make your box smaller.

Now you know how to create your own 2D camera and how to limit their movement with containers. Don’t be afraid to experiment with your cameras and I’ll see you in the next tutorial!

--

--