1
00:00:03,140 --> 00:00:07,300
In this lecture, we'll be creating ourselves a fellow camera using cinema sheen.

2
00:00:07,310 --> 00:00:08,720
So let's get started.

3
00:00:08,900 --> 00:00:11,780
Let's start by talking a little bit about what is Cinema Machine.

4
00:00:11,780 --> 00:00:17,210
So Center Machine is a powerful package that we're going to import that lets us manage multiple cameras

5
00:00:17,210 --> 00:00:22,640
in our scene, if that's what we'd like to do or to easily create rules for our cameras, which is what

6
00:00:22,640 --> 00:00:23,740
we're definitely going to do.

7
00:00:23,750 --> 00:00:27,950
We're going to create rules about following the player and just visually representing that.

8
00:00:27,950 --> 00:00:28,940
We have a main camera.

9
00:00:28,940 --> 00:00:30,800
That's always what we see on our screen.

10
00:00:30,800 --> 00:00:33,440
We're looking through the main camera, the game world.

11
00:00:33,440 --> 00:00:38,600
So if I jump back here, when we click on play, we see the game, it's coming through our main camera

12
00:00:38,600 --> 00:00:42,890
and on our main camera we're going to add a sign, a machine brain, which is going to handle the logic

13
00:00:42,890 --> 00:00:46,130
for saying, what is it that you would like the main camera to be doing?

14
00:00:46,130 --> 00:00:51,260
And in the center machine brain, we can then point different virtual cameras.

15
00:00:51,260 --> 00:00:54,770
They're called virtual cameras that the cinema machine brain manages.

16
00:00:54,770 --> 00:00:59,210
You say one camera is four if you're going really fast and a different camera is four, if you're going

17
00:00:59,210 --> 00:01:04,489
really slow and another camera might be zoomed in all the way, if you're doing a power up or another

18
00:01:04,489 --> 00:01:06,110
camera might have another sort of behavior.

19
00:01:06,110 --> 00:01:11,420
So for us in this project, which is going to be using one virtual camera and it's going to be managed

20
00:01:11,420 --> 00:01:16,070
by the center machine brain, and it's going to be telling the main camera, here's what I want you

21
00:01:16,070 --> 00:01:16,460
to do.

22
00:01:16,460 --> 00:01:18,830
So there's some terminology for you with center machine.

23
00:01:18,830 --> 00:01:23,630
It's super, super, super powerful, particularly for cut scenes and cinematic moments.

24
00:01:23,630 --> 00:01:28,610
We're just going to be using it for a basic gameplay flow camera functionality for now.

25
00:01:28,610 --> 00:01:31,460
So let's go and hook up that functionality we're talking about.

26
00:01:31,460 --> 00:01:36,590
So it is a package of machines, a package you see under assets, there's packages we've already got

27
00:01:36,590 --> 00:01:40,670
a handful of packages that are standard project will already give you.

28
00:01:40,670 --> 00:01:46,760
So Unity has said, okay, we reckon people want these straight away, but if they gave you every single

29
00:01:46,760 --> 00:01:52,370
possible package, then every project is going to be gigantic and size and take ages to load and be

30
00:01:52,370 --> 00:01:52,940
cumbersome.

31
00:01:52,940 --> 00:01:57,890
So they allow us as a user to choose which packages we want and to find packages.

32
00:01:57,890 --> 00:02:03,830
We go to window and then we find the package manager, which is a window click on that.

33
00:02:03,830 --> 00:02:05,840
That will bring up a new window for us.

34
00:02:05,840 --> 00:02:08,389
We can dock this next to our scene window.

35
00:02:08,419 --> 00:02:08,930
There we go.

36
00:02:08,930 --> 00:02:12,860
It's nice and tidy in there and we've got a couple of pull downs up at the very top.

37
00:02:12,860 --> 00:02:14,540
You see packages in project.

38
00:02:14,540 --> 00:02:16,220
These are the ones that in the project already.

39
00:02:16,220 --> 00:02:21,500
It's really important that we change that to be Unity Registry that will give us access to all of the

40
00:02:21,500 --> 00:02:24,380
packages that we can import through this process.

41
00:02:24,380 --> 00:02:29,120
And you scroll down, you see cinema screen is in here or we could go to the search box and just type

42
00:02:29,120 --> 00:02:34,490
for Sinar machine and you'll see that it shows us the cinema scene package down the bottom right of

43
00:02:34,490 --> 00:02:35,630
our package manager window.

44
00:02:35,630 --> 00:02:36,680
There's an install button.

45
00:02:36,680 --> 00:02:37,730
Go ahead and click on that.

46
00:02:37,730 --> 00:02:42,980
That will do all of the process of downloading if you haven't downloaded it already and importing and

47
00:02:42,980 --> 00:02:47,330
installing that into our project, putting everything in the place where it should be.

48
00:02:47,330 --> 00:02:50,690
And then once you see all the pop up windows are done, it will be finished.

49
00:02:50,690 --> 00:02:53,720
You know that you've got it installed properly if you now have the remove button.

50
00:02:53,720 --> 00:02:57,800
So we probably don't need the package manager anymore for this project, but we'll leave it there.

51
00:02:57,800 --> 00:02:59,150
We'll click back on scene.

52
00:02:59,150 --> 00:03:05,090
I just rearrange the sizing of my windows here and you can see under packages we now have sinner machine

53
00:03:05,090 --> 00:03:06,440
halfway down our list there.

54
00:03:06,470 --> 00:03:08,870
Okay, we don't need to go in that packages folder anymore.

55
00:03:08,870 --> 00:03:12,680
What we do need to do is jump up to component and find cinema machine.

56
00:03:12,680 --> 00:03:16,910
We could also do this by right clicking in the hierarchy and you'll see cinema screen in there.

57
00:03:16,910 --> 00:03:20,660
So there's the two ways to get to this particular menu we're looking for.

58
00:03:20,660 --> 00:03:25,580
So we'll do it the right click in the Hierarchy Mechanism Cinema screen, and then I want to find a

59
00:03:25,580 --> 00:03:26,930
virtual camera.

60
00:03:26,930 --> 00:03:32,180
So the moment I add a virtual camera, you see next to my main camera, a little icon has appeared.

61
00:03:32,180 --> 00:03:34,100
There will jump and click on the main camera.

62
00:03:34,100 --> 00:03:36,710
It's automatically added the cinema screen brain.

63
00:03:36,710 --> 00:03:41,180
In the past we needed to add the cinema machine brain manually, but as soon as you put in this virtual

64
00:03:41,180 --> 00:03:45,440
camera, it's saying, Ah, I'll pop this brain onto the main camera.

65
00:03:45,440 --> 00:03:49,400
Now, we don't need to worry about any of this stuff for now because we've only got the one virtual

66
00:03:49,400 --> 00:03:49,790
camera.

67
00:03:49,790 --> 00:03:54,740
So basically the centre machine brain is saying, well, I guess we'll just do your one camera for you

68
00:03:54,740 --> 00:03:56,120
then, which is super handy.

69
00:03:56,120 --> 00:04:04,580
Let's click on the CMV cam one and just rename that to B v c to stand for virtual camera and then follow

70
00:04:04,580 --> 00:04:06,470
camera hit enter.

71
00:04:06,470 --> 00:04:09,890
Now when we click on this follow camera, we get a whole bunch of information.

72
00:04:09,890 --> 00:04:14,180
If you scroll down there, there's knobs and levers and dials and things to twiddle.

73
00:04:14,180 --> 00:04:17,660
And if you like tuning things, there's a lot of great stuff in here.

74
00:04:17,660 --> 00:04:24,040
The main thing we want to look at at the moment is changing the body so that we use the framing transpose

75
00:04:24,040 --> 00:04:24,260
user.

76
00:04:24,290 --> 00:04:28,970
That is a way of saying we're trying to frame a particular thing in our world and we're going to be

77
00:04:28,970 --> 00:04:31,880
moving around the body of our virtual camera.

78
00:04:31,910 --> 00:04:36,410
Now you see under the cinema scene virtual camera module, we have this field called Follow.

79
00:04:36,440 --> 00:04:38,930
If I click on the selector, at the moment we don't have a lot.

80
00:04:38,930 --> 00:04:39,860
We've just got the ball.

81
00:04:39,860 --> 00:04:42,260
We don't have a player yet, so let's double click on the ball.

82
00:04:42,260 --> 00:04:46,760
And now you see in our game window we've got this red stuff around the outside and the blue stuff in

83
00:04:46,760 --> 00:04:47,210
the middle.

84
00:04:47,210 --> 00:04:53,660
But if we click on play, you can see in the scene view that the camera is going to follow and roll

85
00:04:53,660 --> 00:04:57,230
along with the ball as a ball guy goes and the ball is moving along.

86
00:04:57,230 --> 00:05:02,330
So our game view is following our objective interest and this is.

87
00:05:02,360 --> 00:05:05,900
By far and away the simplest way to add a follow camera in unity.

88
00:05:05,900 --> 00:05:08,300
It's brilliant and you get a nice bit of smoothing.

89
00:05:08,300 --> 00:05:12,530
See how this is the middle of the camera and the yellow dot is saying, this is what I'm going to be

90
00:05:12,530 --> 00:05:13,280
looking at.

91
00:05:13,280 --> 00:05:15,260
And there's some nice smoothing.

92
00:05:15,260 --> 00:05:17,930
So it's not jarring as you're moving through the world.

93
00:05:17,930 --> 00:05:19,400
There's smoothing and easing and stuff.

94
00:05:19,400 --> 00:05:22,640
So a lot of this stuff comes for free when we create our follow camera.

95
00:05:22,640 --> 00:05:27,110
And the last step, I'll just click out of play mode so we can go back into seeing what our camera is

96
00:05:27,110 --> 00:05:27,550
showing us.

97
00:05:27,560 --> 00:05:33,020
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

98
00:05:33,020 --> 00:05:33,830
what's coming up.

99
00:05:33,830 --> 00:05:38,750
I don't really care about what I've already gone past in this particular game, so we'll find the one

100
00:05:38,750 --> 00:05:43,010
control that's going to change that is going to be for us the screen x value.

101
00:05:43,010 --> 00:05:48,680
So screen x, you can see if you move it left or right, it gives a preference to where our camera's

102
00:05:48,680 --> 00:05:49,850
middle point is on the screen.

103
00:05:49,850 --> 00:05:55,670
I'm just going to move it to about point two, 4 to 5, I think point 25.

104
00:05:55,670 --> 00:05:56,480
I'll type that in.

105
00:05:56,480 --> 00:06:02,180
Now when I click on play, it will keep the camera highlighted on the ball, but it will show us all

106
00:06:02,180 --> 00:06:06,200
of the world that's in front of the ball again with a little bit of easing and all that kind of stuff

107
00:06:06,200 --> 00:06:06,620
going on.

108
00:06:06,650 --> 00:06:07,940
Okay, so those are the major steps.

109
00:06:07,940 --> 00:06:12,200
But what I'll do is just to give you a challenge in case you haven't implemented this yet, as we've

110
00:06:12,200 --> 00:06:15,920
been going through it, but also as a reminder in the future, if you want to come back and say, how

111
00:06:15,920 --> 00:06:17,660
do we do that cinema screen stuff again?

112
00:06:17,660 --> 00:06:18,770
So here's the challenge.

113
00:06:18,770 --> 00:06:24,770
And or reminder, add the package manager window, find an install center machine at a virtual camera

114
00:06:24,770 --> 00:06:29,810
and that will by default add the center machine brain to our main camera, point the virtual camera

115
00:06:29,810 --> 00:06:31,010
to follow the ball.

116
00:06:31,010 --> 00:06:35,930
So you need to find the flow setting and then select on the object of interest and then change the screen

117
00:06:35,930 --> 00:06:37,760
x value to show more of what's to come.

118
00:06:37,760 --> 00:06:39,200
That's for this particular game.

119
00:06:39,200 --> 00:06:40,820
Other games, you might not want to do that.

120
00:06:40,820 --> 00:06:45,590
And then while we're here, feel free to play around with the other settings to see what they do and

121
00:06:45,590 --> 00:06:48,830
to just have a play around with a machine to get comfortable with it.

122
00:06:48,830 --> 00:06:52,490
But the goal of this exercise, the goal of the challenge is to end up with the same thing that I've

123
00:06:52,490 --> 00:06:56,540
got here, where we're following the ball in a nice, smooth manner and showing a little bit of the

124
00:06:56,540 --> 00:06:57,680
screen ahead of us.

125
00:06:57,680 --> 00:06:58,640
So that's the challenge.

126
00:06:58,640 --> 00:07:03,200
If you haven't done that now, pause the video, take that on, and when you're finished, all of that

127
00:07:03,200 --> 00:07:06,650
jump into the next lecture and we'll continue on with our snowboarder game.

128
00:07:06,650 --> 00:07:08,000
So see you in the next lecture.

