1
00:00:00,000 --> 00:00:00,000
Hello, guys.

2
00:00:00,000 --> 00:00:04,000
There is something else we need to do before we finally build level parts.

3
00:00:04,000 --> 00:00:10,000
We need to restrict movement of the camera, because at the moment, our camera follows the player on

4
00:00:10,000 --> 00:00:15,000
x and y axis and we somehow need to block y axis movement.

5
00:00:15,000 --> 00:00:16,000
Look at this.

6
00:00:16,000 --> 00:00:24,000
If I jump on the high platforms that are kind of upstairs, you can see my camera went up and now I

7
00:00:24,000 --> 00:00:25,000
don't see what is below.

8
00:00:25,000 --> 00:00:27,000
And that could go endlessly.

9
00:00:27,000 --> 00:00:34,000
And in the end we would lose view of our town or, you know, just basically it's not even coming back

10
00:00:34,000 --> 00:00:34,000
down.

11
00:00:34,000 --> 00:00:35,000
If I need to.

12
00:00:35,000 --> 00:00:38,000
Look, I'm jumping low and I cannot see my character.

13
00:00:38,000 --> 00:00:40,000
I even died because of the dead zone.

14
00:00:40,000 --> 00:00:43,000
So this is what we're going to do in this video, how we can do that.

15
00:00:43,000 --> 00:00:49,000
If you take a polygon collider and you give it to cinema machine, Cinema machine will move inside of

16
00:00:49,000 --> 00:00:50,000
that collider.

17
00:00:50,000 --> 00:00:52,000
So that's how we do it.

18
00:00:52,000 --> 00:00:58,000
We go to Cinema Machine, add ext confine there to DX and now we can see it says about in shape is required.

19
00:00:59,000 --> 00:01:00,000
So this what we need to do.

20
00:01:00,000 --> 00:01:07,000
And for this one we must use Polygon Collider and we need to make sure this collider moving together

21
00:01:07,000 --> 00:01:08,000
with a camera.

22
00:01:08,000 --> 00:01:13,000
So what I want to do here is to take background number five because it moves together with a camera

23
00:01:13,000 --> 00:01:19,000
with the same speed and put collider on this object and then use this object with this collider is a

24
00:01:19,000 --> 00:01:22,000
confined air to blow camera movements.

25
00:01:22,000 --> 00:01:29,000
All right, so let's click add component Polygon Collider Right now we need to change the size and yours

26
00:01:29,000 --> 00:01:30,000
might look different.

27
00:01:30,000 --> 00:01:32,000
Yours might look like a polygon, but it doesn't matter.

28
00:01:32,000 --> 00:01:33,000
You just click point.

29
00:01:33,000 --> 00:01:37,000
So here, make sure it size is four.

30
00:01:38,000 --> 00:01:44,000
Then let's click edit Collider and just make it, you know, like a size of a town, let's say.

31
00:01:44,000 --> 00:01:49,000
So a bit above the city line and just below the camera somewhere here.

32
00:01:49,000 --> 00:01:50,000
You don't need to copy it.

33
00:01:50,000 --> 00:01:51,000
Exactly.

34
00:01:51,000 --> 00:01:53,000
Just supposed to be bigger than the camera itself.

35
00:01:58,000 --> 00:02:01,000
What I mean by that is this is the collider of the camera, the white one.

36
00:02:01,000 --> 00:02:04,000
And this polygon collider should be bigger than that.

37
00:02:04,000 --> 00:02:07,000
So camera can move inside of this collider.

38
00:02:07,000 --> 00:02:11,000
And let's find some it's set the size.

39
00:02:12,000 --> 00:02:13,000
So I think this is okay.

40
00:02:13,000 --> 00:02:16,000
Just above the skyline, four bit and below the camera.

41
00:02:16,000 --> 00:02:17,000
It's okay.

42
00:02:17,000 --> 00:02:20,000
Now I want to change these numbers because I don't like numbers like this.

43
00:02:20,000 --> 00:02:22,000
I want them to be even.

44
00:02:22,000 --> 00:02:28,000
So what I'm going to do here is to make it -0.5 here as well.

45
00:02:29,000 --> 00:02:31,000
Same for positive value.

46
00:02:36,000 --> 00:02:36,000
For the Y.

47
00:02:36,000 --> 00:02:38,000
This one looks like three.

48
00:02:38,000 --> 00:02:40,000
This one looks like minus two.

49
00:02:40,000 --> 00:02:42,000
Minus two and three.

50
00:02:42,000 --> 00:02:43,000
Okay.

51
00:02:43,000 --> 00:02:44,000
That's good.

52
00:02:44,000 --> 00:02:48,000
Now, let's make sure we check is trigger so it won't collide with objects.

53
00:02:49,000 --> 00:02:53,000
We can cover this select Sigma machine and drag collider of the background.

54
00:02:53,000 --> 00:02:55,000
Number five over here.

55
00:02:56,000 --> 00:02:56,000
Boom!

56
00:02:56,000 --> 00:03:00,000
Now, let's click this oversize window and then click again.

57
00:03:00,000 --> 00:03:04,000
Because sometimes, for some reason, Collider is not updated.

58
00:03:04,000 --> 00:03:09,000
What I mean by that, Look, if I change this collider here to something like this and I choose my cinema

59
00:03:09,000 --> 00:03:14,000
machine, it's not updated, but if I'll click over size window a couple of times, then it will be

60
00:03:14,000 --> 00:03:15,000
updated.

61
00:03:15,000 --> 00:03:17,000
So that's what we need to do.

62
00:03:18,000 --> 00:03:20,000
Now let's let me revert the changes.

63
00:03:26,000 --> 00:03:26,000
Yeah.

64
00:03:26,000 --> 00:03:29,000
So here is the settings for Polygon Collider.

65
00:03:29,000 --> 00:03:29,000
You can see it.

66
00:03:29,000 --> 00:03:31,000
These are my numbers.

67
00:03:31,000 --> 00:03:34,000
You're supposed to be kind of the same, but if it's a bit different, don't worry.

68
00:03:34,000 --> 00:03:39,000
Just make sure this collider is bigger than this white box of the camera and gives.

69
00:03:40,000 --> 00:03:43,000
All right, now let's go and see what it gives us.

70
00:03:43,000 --> 00:03:48,000
Now, if we try this, we can see that camera cannot exceed the collider we just created.

71
00:03:48,000 --> 00:03:49,000
Let me find it.

72
00:03:51,000 --> 00:03:52,000
Here is the cinema machine.

73
00:03:52,000 --> 00:03:57,000
This is the collider and this is the camera itself right here.

74
00:03:57,000 --> 00:04:00,000
And it cannot exceed the collider, which is good, which is what we need.

75
00:04:00,000 --> 00:04:05,000
Now, I want to adjust camera behavior for a bit so it will look a bit better when he moves down.

76
00:04:05,000 --> 00:04:12,000
Let's go to body of the cinema machine over here, buddy, and what we're going to do here.

77
00:04:14,000 --> 00:04:16,000
Increasing the dead zone on the height.

78
00:04:17,000 --> 00:04:23,000
And increase in soft zone on the height just like that, and then going to move bias on the Y.

79
00:04:24,000 --> 00:04:26,000
Do something like this.

80
00:04:26,000 --> 00:04:31,000
Let me increase the zone of the so I can see it because it's not really visible.

81
00:04:31,000 --> 00:04:33,000
Just point one so we can see the box.

82
00:04:34,000 --> 00:04:35,000
Right.

83
00:04:38,000 --> 00:04:39,000
This the one?

84
00:04:46,000 --> 00:04:47,000
Straight point five.

85
00:04:55,000 --> 00:05:01,000
Let's decrease the height of the dead zone, but increase height of the south zone to something like

86
00:05:01,000 --> 00:05:03,000
this so camera can move above.

87
00:05:03,000 --> 00:05:07,000
But if we going down, Camara should move down really fast.

88
00:05:07,000 --> 00:05:08,000
Let's try this.

89
00:05:08,000 --> 00:05:11,000
I'm going to adjust my level parts to something different.

90
00:05:23,000 --> 00:05:25,000
When we're going up, it moves up slowly.

91
00:05:25,000 --> 00:05:27,000
But if I go down, it moves down fast.

92
00:05:29,000 --> 00:05:29,000
Cool.

93
00:05:29,000 --> 00:05:31,000
You can see the difference, right?

94
00:05:31,000 --> 00:05:32,000
Look how it moves up.

95
00:05:32,000 --> 00:05:33,000
Very smoothly.

96
00:05:33,000 --> 00:05:34,000
And if I'm falling.

97
00:05:35,000 --> 00:05:36,000
Boom.

98
00:05:41,000 --> 00:05:42,000
Boom.

99
00:05:45,000 --> 00:05:45,000
Cool.

100
00:05:46,000 --> 00:05:49,000
So this is the settings of this machine container.

101
00:05:50,000 --> 00:05:52,000
This is the size of the collider.

102
00:06:01,000 --> 00:06:04,000
And this is the settings of the body of cinema machine.

103
00:06:05,000 --> 00:06:07,000
See in the next video.

