In this lecture, we're going to be setting up a machine flow camera so that we can finally run around
all the different parts of our level.
We've set up a machine before in the course, so if you already know how to do it and you want to try
doing this on your own, there's the challenge for you.
Jump in and do that.
If you want to do this together, then let's jump in and take it on together.
And I open up the package manager and search for center machine.
Maybe we can do this as a little bit of a race to see whether you can set up your center machine, follow
camera before I can.
So consider that a challenge, a duel.
I'm laying down the gauntlet.
I'm installing a machine from the package manager.
If you currently don't have it installed in your project, you'll need to do the same and I'll leave
this whole stuff going on.
So if we are doing this as a race, if you're saying I'm going to set up my set of machine quicker than
Rick, maybe it's dependent upon how quick your computer is.
And my computer, while we wait for all these aspects to load and install mine is now finished.
Awesome.
You can see the remove button in there.
Should be there if it's all done and dusted and click back on my scene view so I can see what's happening
now.
I'm going to right click in my hierarchy, create a machine, virtual camera.
I'm going to rename this to be, say, follow camera.
You can name yours whatever you like.
I'm going to drag it.
So it sits generally underneath the main camera in that ballpark, not as a child just next to it.
And the follow camera I'm going to click on and I'm going to change the body to be a framing transfer
user.
And I'm going to follow click on the little selector on follow.
We'll follow the player.
Now if I click on play and click on the game window should automatically go to the game window.
You can see that we're running around.
So there we go.
It's in a machine.
Job done well, mostly job done.
What I'd like to do is tweak it a little bit so you can see it's quite an aggressive follow at the moment
as we jump up and down.
I think that's a little bit annoying.
I want to soften that.
I can change the dampening.
I'm also going to change the dead zone.
So let's see side note if we're having a race, this is probably the point where if you finished, then
cool, we've finished the race.
I'm now going to tweak it a little bit and see what we can do.
If we make the changes while we're in play mode, then we keep them.
It's not a case that we lose them when we get out of play mode.
So I'm just going to increase the dead zone width.
You can see there it makes these lines open up a little bit and the dead zone height as well.
What that does is let me just make this more pronounced.
It means that I can run in that area and the camera won't move at all until I get to the edge of the
area.
Then it will start to move again.
I don't want to have it quite so wide, but we want to have a little bit in there, I think a little
bit of say 0.1 and probably 0.1 as well on the height.
Now, the height, as I mentioned before, is a little bit more aggressive than I want.
So I'm going to change the Y dampening.
Might pop it up to say five, see how that works so that when you jump up and down, it slowly tries
to find the player again.
It's not going don't really quickly and but I think it's okay to go very quickly on the X and the Y
to try to catch up to the player.
You can see the yellow dot.
There is what the camera is trying to say.
Keep that dot within the framing of what's our dead zone area.
So if we get out of the dead zone, then bring the dead zone up to it.
So it's touching it.
So there we go.
That's pretty much all I wanted to do.
I might play around in the future with the lens ortho size.
That's how you move the camera in and out.
You can see the camera distance here doesn't do anything because we're currently framed on the player.
We're using this framing transpose, but if I change the ortho size, I could move back a little bit
if I wanted to have more level and less player or moving closer.
If I wanted to get closer relationship to the personality of the player, I'm going to leave it as the
default five for now until I have more gameplay in my game and see what I might actually need.
But there we go.
That's setting up the basics of our center machine for the camera.