How to Install and Use Cinemachine to Create a Player Follow Camera in Unity [2021]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone and welcome to plus equal today we are here to talk about cine machine but first let me go to discord in our own server we already have seven people here and the last time i was here there was only me so let me give a huge shout out to ali gamedev anzai korte slings pinyir teludu and ataid for joining our discord server in this early phase i promise you that i will take a time to fill information and more channels here but we are not here for discord we are here to talk about cinemachine so let's begin so some of you might be familiar with the cinema machine others don't basically using a machine is something that will allow you to control the cameras it's a super powerful asset that unity acquired some time ago and it's free you can just import the package into your unity version so that's what we are doing next but and while we go i will explain more of in a machine for you but yeah basically set up cameras and setup rules for the cameras here inside unity we have always our main camera right so basically imagine that i want my camera to follow the player so in the last tutorials i teach you how to move the player but you see that the camera is static the camera is not moving if i go there i won't see the player anymore because the camera is stuck here i want to follow the player a very common thing in games right you can call this behavior to follow the camera and i think that i will do it in the next tutorial so you guys will have a a full camera within a machine and a full camera with custom code so yeah i will do it i'll take a note here but for this lesson i want to go to package manager in order for us to download and install cinema machine into this unity version and project so let's go to window package manager and this will be refreshing the package you might need to wait a little bit and now this is showing packages in project so this is basically what we have here under package folder and we need to add the cinema machine so we'll press the button here we go into unity registry and we might look for cinema machine or you can find it right here so i'll press here and you can see that is verified that's good and we can install the version 2.6.5 so let's press install and after all the compiling okay volatile machine is installed and you can see that in the packages we have seen a machine here that's pretty good no error so far i think we can exit this window here and we can go now into the main camera and let's add a component let's search for cne machine brain and here we have it's in the machine brain basic basically this will allow you to control your camera your virtual camera in this case so if you press here you add this component to your main camera and now we need to here on the top after the installs in a machine it will appear a menu here so you press in a machine and create virtual camera boom there we go we are setting up our new camera here and the name of the camera is cmv cam one this stands for cinema machine virtual camera one and i like to put this camera close to the other one just in case we need the cameras they are here also here inside the main camera we should have this camera here that we just created so that's good we and we want that to be linked so now that we have a cinemachine brain because this is so smart we just need to tell him to follow our game object so we go into our virtual camera and right here you can see follow the object that the camera wants to move with the body target if this is new then the vcam transform position will define the camera's position that's exactly what we want so for now i will delete this share i will call my cube player i go to the vcam again and i'll press here this button and i will follow the player that seems about right now we quit here you can adjust your camera to your needs i think i will put mine on something like something like this try to make it game object align with view it's a way too forward okay looks a little better more centered on the screen this should do it you have a ton of ways to customize this but for now i think i will leave it like this and just press play and see if this is working so here is our game view i will actually maximize this for now and if i move you can see that my camera is following me but because my player is too fast it takes some times to the camera to to stick with the game object so if you want your player to always be visible you can put this damping to zero i actually like the effect so i'll put this only for like example.2.2 why not do as well even if you are not using the e i access the y axis but it's okay let's press play and let's try now okay it's a little better now with the flickering because it's trying to keep up with the object you can also experiment here if you want you can change the offset for example i can reduce the damping to zero in all axes and now my object will be stuck in the center of the camera so that's the basics to work with cinema machine and to create a follow camera for your game object i hope you guys found this tutorial useful in the next tutorial i will show you how to create this with some simple lines of code so i will see you guys in the next tutorial don't forget to subscribe and leave a like and consider to join our discord server so that's it for this tutorial i will see you in the next one thank you a lot for watching i'll see you there
Info
Channel: PlusEqual
Views: 806
Rating: undefined out of 5
Keywords: unity 2020, unreal engine, how to create games, unity C#, unreal c++, free online course, online best tutorials, unity tutorials, unreal tutorials, unity cinemachine, cinemachine, cinemachine tutorial, how to create a follow camera, how to make a camera follow the player, cinemachine damping, cinemachine follow camera, cinemachine offset, camera follow script, install cinemachine, cinemachine package manager, how to use cinemachine
Id: 17GqV2I3-jo
Channel Id: undefined
Length: 7min 8sec (428 seconds)
Published: Mon Jun 28 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.