Celeste's Camera Follow - Unity Cinemachine Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey what's up guys the spin monk and today in this video I'm going to teaching you how to make a camera follow system like Celeste this is a very simple camera following system where it will be multiple different rooms and you can smoothly transition between each different rooms without having to load the Newseum final product will look something like this where I have a room and I can go and jump between them gonna be a very smooth camera transition it's really easy to make and we're gonna be using the cinema screen for this tutorial so let's get started so right off the bat I've set up my scene I have a player that can move around in just a few game objects with colliders so the first thing I'm going to do is I'm gonna have to import some machine and if you're nest in a machine it's very very good asset that you can import and it's great for camera balls and I like my stuff so you wanna go to window package manager click all packages scroll down and find some machine and then just hit import I already have imported so I don't have to do it right now just wait for that import and when you finally do we are gonna go to cinema sheen and we're going to create 2d camera now this is a virtual camera and we're gonna have to adjust this to our light games as you can see it is kind of a little bit funky right now but we can get that work in just a second so the first thing I want to do is in this follow I want to follow my player and so I'm gonna drag that right here I don't really like how this looks so I'm gonna change the orthographic size and just zoom it in a bit and I also want this to go a bit higher and so I'm gonna go to my screen Y and move it up a little it doesn't have to be perfect jump so I'm going to do this really quickly but you won't want to make it perfect for the sake of your game there's a lot of settings you can do with sin machine so you can just tamper around these your own a lot of really good tutorials on it but if you already do have a similar scene at Oriel camera already made perfect so right now you do have a really simple camera follow it's nothing great we could soon some time to make it better but I'm gonna let that up to you so for let's take a tutorial I want my camera to be limited to a certain room so I can't move around and just be stuck in a certain room so what I'm gonna do is I'm gonna click on my virtual camera I'm going to add extension and I'm gonna cinema screen collider I'll just add that next thing we're going to do is create an empty game object and we can just call it this room one or whatever room you want this to be and you want to make sure if you're using raycast to have big doorway casts on we're going to add a polygon Collider it has to be a called polygon Collider do not try to add a box Collider or get away with that just use the polygon Collider make sure to set it to is trigger and we're gonna try to set this to the size of our room what I'm going to do is edit Collider or first I'm going to points have four points so be easier to edit and I'm just gonna drag this kind of to the point of our room just to make sure I can cover the whole space point is I'll just make a Collider and you can make your own Collider and I'll cut this here and just once you get a somewhat good-looking plug on Collider just use that and we can resume the tutorial now the next thing that we are going to do after I've made my room have a perfect Collider pretty much matching things so my camera won't move what I'm going to do is I'm going to click on my CV you can or whatever and just drag it in as I've already done now that I hit play if you've done this correctly your camera should not move at all and it should stay still and not going beyond the boundaries that's great if it's not working for you to try messing around with your poly or thira polygon Collider and get that to work that way so now that we have this we need to make a simple script so first thing I'm going to do is I'm asked in action first actually for the script I'm gonna drag my CV can under my room and then that's gonna duplicate this room and I'm just going to drag it this way and I'm gonna make sure these do not overlap last thing you want them to do is overlap I'm gonna rename this to room number two and I'm just gonna try to get this to get to the next side I can see these are not overlapping so that's perfect now that we have room number two we have CV can number two let's make sure that our we have different polygon colliders and see this is room to room one it's in this cam let's actually name is cam two and cam one just me remember that his room one it's a perfect and has room to and all to do that so that's really nice next thing we need to do is make a script to manually transfer the squints switch between these cameras as when we get when we're in this Collider we wanted to be on this camera but when we go over to this Clyde er we want to be on this camera so let's make a script right now let's create AC sir she C sharp script and let's just call his room or room manager or whatever you want to name this and let's just open that up and here we go so the first thing we want to do is make you reference to our virtual camera the public game object and call this a virtual camera the next thing we're going to do is it becomes delete start and update and let's make a void ontriggerenter 2d and let's just name this closing to author just so it's more clear we're going to check if our other dot compare tag is to our player and we want to make sure to add the player tag to our player so ever your player is the tag player to them let's head back into our script and next let's add a and condition to make sure we are knocked and is trigger so whatever our collider is is not a trigger then we can say if this is true our virtual cam dot set dot set active and let's pass in true now we can duplicate this we can make on trigger exit 2d and we can set this to false so that's really really all the script is let's head back into unity on our room script and are just drag it in here actually our room same with here dragging a room virtual can just drag in that virtual camera that you're using and let's test it out it's gonna see let me hit play actually no not before you hit play you want to make sure to disable both of your virtual cameras now let's hit play and or detect this first one you can see this one instead of active and this one says it's not active so we can move around just fine let's head over here you notice it makes a very very slow transition and that is kind of something we do not want it's okay if you can but if we want to edit this go to main camera and then let's see going ease in out let's up the second something more snappy like 0.5 you really change that depending on what you want now let's go back now we have a boom very snappy transition and this is super easy to implement it's really that it you can just keep on making different rooms with different triggers and that's really just is a Celeste camera system I hope you enjoy this video if you have any comments just let me know and I'll try to answer them and yeah I hope this helped you out I'll see you in the next video
Info
Channel: BenBonk
Views: 44,609
Rating: undefined out of 5
Keywords: celeste, celeste's camera, unity, tutorial, gamedev, cinemachine, unity cinemachine tutorial, celeste camera, celeste swapping scenes tutorial, cinemachine camera transitions, BenBonk
Id: yaQlRvHgIvE
Channel Id: undefined
Length: 8min 26sec (506 seconds)
Published: Sat Nov 23 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.