In this lecture, we'll be creating ourselves a fellow camera using cinema sheen.
So let's get started.
Let's start by talking a little bit about what is Cinema Machine.
So Center Machine is a powerful package that we're going to import that lets us manage multiple cameras
in our scene, if that's what we'd like to do or to easily create rules for our cameras, which is what
we're definitely going to do.
We're going to create rules about following the player and just visually representing that.
We have a main camera.
That's always what we see on our screen.
We're looking through the main camera, the game world.
So if I jump back here, when we click on play, we see the game, it's coming through our main camera
and on our main camera we're going to add a sign, a machine brain, which is going to handle the logic
for saying, what is it that you would like the main camera to be doing?
And in the center machine brain, we can then point different virtual cameras.
They're called virtual cameras that the cinema machine brain manages.
You say one camera is four if you're going really fast and a different camera is four, if you're going
really slow and another camera might be zoomed in all the way, if you're doing a power up or another
camera might have another sort of behavior.
So for us in this project, which is going to be using one virtual camera and it's going to be managed
by the center machine brain, and it's going to be telling the main camera, here's what I want you
to do.
So there's some terminology for you with center machine.
It's super, super, super powerful, particularly for cut scenes and cinematic moments.
We're just going to be using it for a basic gameplay flow camera functionality for now.
So let's go and hook up that functionality we're talking about.
So it is a package of machines, a package you see under assets, there's packages we've already got
a handful of packages that are standard project will already give you.
So Unity has said, okay, we reckon people want these straight away, but if they gave you every single
possible package, then every project is going to be gigantic and size and take ages to load and be
cumbersome.
So they allow us as a user to choose which packages we want and to find packages.
We go to window and then we find the package manager, which is a window click on that.
That will bring up a new window for us.
We can dock this next to our scene window.
There we go.
It's nice and tidy in there and we've got a couple of pull downs up at the very top.
You see packages in project.
These are the ones that in the project already.
It's really important that we change that to be Unity Registry that will give us access to all of the
packages that we can import through this process.
And you scroll down, you see cinema screen is in here or we could go to the search box and just type
for Sinar machine and you'll see that it shows us the cinema scene package down the bottom right of
our package manager window.
There's an install button.
Go ahead and click on that.
That will do all of the process of downloading if you haven't downloaded it already and importing and
installing that into our project, putting everything in the place where it should be.
And then once you see all the pop up windows are done, it will be finished.
You know that you've got it installed properly if you now have the remove button.
So we probably don't need the package manager anymore for this project, but we'll leave it there.
We'll click back on scene.
I just rearrange the sizing of my windows here and you can see under packages we now have sinner machine
halfway down our list there.
Okay, we don't need to go in that packages folder anymore.
What we do need to do is jump up to component and find cinema machine.
We could also do this by right clicking in the hierarchy and you'll see cinema screen in there.
So there's the two ways to get to this particular menu we're looking for.
So we'll do it the right click in the Hierarchy Mechanism Cinema screen, and then I want to find a
virtual camera.
So the moment I add a virtual camera, you see next to my main camera, a little icon has appeared.
There will jump and click on the main camera.
It's automatically added the cinema screen brain.
In the past we needed to add the cinema machine brain manually, but as soon as you put in this virtual
camera, it's saying, Ah, I'll pop this brain onto the main camera.
Now, we don't need to worry about any of this stuff for now because we've only got the one virtual
camera.
So basically the centre machine brain is saying, well, I guess we'll just do your one camera for you
then, which is super handy.
Let's click on the CMV cam one and just rename that to B v c to stand for virtual camera and then follow
camera hit enter.
Now when we click on this follow camera, we get a whole bunch of information.
If you scroll down there, there's knobs and levers and dials and things to twiddle.
And if you like tuning things, there's a lot of great stuff in here.
The main thing we want to look at at the moment is changing the body so that we use the framing transpose
user.
That is a way of saying we're trying to frame a particular thing in our world and we're going to be
moving around the body of our virtual camera.
Now you see under the cinema scene virtual camera module, we have this field called Follow.
If I click on the selector, at the moment we don't have a lot.
We've just got the ball.
We don't have a player yet, so let's double click on the ball.
And now you see in our game window we've got this red stuff around the outside and the blue stuff in
the middle.
But if we click on play, you can see in the scene view that the camera is going to follow and roll
along with the ball as a ball guy goes and the ball is moving along.
So our game view is following our objective interest and this is.
By far and away the simplest way to add a follow camera in unity.
It's brilliant and you get a nice bit of smoothing.
See how this is the middle of the camera and the yellow dot is saying, this is what I'm going to be
looking at.
And there's some nice smoothing.
So it's not jarring as you're moving through the world.
There's smoothing and easing and stuff.
So a lot of this stuff comes for free when we create our follow camera.
And the last step, I'll just click out of play mode so we can go back into seeing what our camera is
showing us.
The last thing I'll do in here is I want to be looking more ahead in the world, so I want to be seeing
what's coming up.
I don't really care about what I've already gone past in this particular game, so we'll find the one
control that's going to change that is going to be for us the screen x value.
So screen x, you can see if you move it left or right, it gives a preference to where our camera's
middle point is on the screen.
I'm just going to move it to about point two, 4 to 5, I think point 25.
I'll type that in.
Now when I click on play, it will keep the camera highlighted on the ball, but it will show us all
of the world that's in front of the ball again with a little bit of easing and all that kind of stuff
going on.
Okay, so those are the major steps.
But what I'll do is just to give you a challenge in case you haven't implemented this yet, as we've
been going through it, but also as a reminder in the future, if you want to come back and say, how
do we do that cinema screen stuff again?
So here's the challenge.
And or reminder, add the package manager window, find an install center machine at a virtual camera
and that will by default add the center machine brain to our main camera, point the virtual camera
to follow the ball.
So you need to find the flow setting and then select on the object of interest and then change the screen
x value to show more of what's to come.
That's for this particular game.
Other games, you might not want to do that.
And then while we're here, feel free to play around with the other settings to see what they do and
to just have a play around with a machine to get comfortable with it.
But the goal of this exercise, the goal of the challenge is to end up with the same thing that I've
got here, where we're following the ball in a nice, smooth manner and showing a little bit of the
screen ahead of us.
So that's the challenge.
If you haven't done that now, pause the video, take that on, and when you're finished, all of that
jump into the next lecture and we'll continue on with our snowboarder game.
So see you in the next lecture.