1
00:00:00,000 --> 00:00:00,000
Hello, guys.

2
00:00:00,000 --> 00:00:02,000
In this video, we're going to talk about particles.

3
00:00:02,000 --> 00:00:05,000
I'm going to show you how to create a simple dust effect.

4
00:00:05,000 --> 00:00:11,000
And before we begin, I want to tell you that particles are entire complicated system that can be in

5
00:00:11,000 --> 00:00:12,000
their profession.

6
00:00:12,000 --> 00:00:14,000
For some people, it is what they say.

7
00:00:14,000 --> 00:00:16,000
Easy to learn, hard to master.

8
00:00:16,000 --> 00:00:18,000
You can make lots of different stuff.

9
00:00:18,000 --> 00:00:19,000
You can make a snow effect.

10
00:00:19,000 --> 00:00:20,000
Fire explosion.

11
00:00:20,000 --> 00:00:24,000
I'm going to show you some examples later in the course, what other people can do.

12
00:00:24,000 --> 00:00:28,000
But in this video, we're going to focus on making simple dust effect.

13
00:00:28,000 --> 00:00:35,000
And then I'm going to make one more video showing what you could do, possibly with particle system.

14
00:00:35,000 --> 00:00:36,000
Okay, let's do dust.

15
00:00:36,000 --> 00:00:37,000
First.

16
00:00:37,000 --> 00:00:43,000
What we need to do is go to effects particle system, and I want to name it Dust Effect, dust picks.

17
00:00:44,000 --> 00:00:51,000
We're going to change rotation to zero because at the moment you can see that particles are flying up

18
00:00:51,000 --> 00:00:53,000
if you see it in 3D space.

19
00:00:53,000 --> 00:00:58,000
But we are into this space, so we need to make it zero rotation on the X and now they're going to fly

20
00:00:58,000 --> 00:01:00,000
kind of like kind of like away from the camera.

21
00:01:00,000 --> 00:01:04,000
But it doesn't matter for us much because we use in 2D.

22
00:01:04,000 --> 00:01:10,000
Let's go back to 2D and I want to place them at the feet of the character over here.

23
00:01:10,000 --> 00:01:12,000
Next step would be to make them visible.

24
00:01:12,000 --> 00:01:14,000
We can do it with a certain layer.

25
00:01:15,000 --> 00:01:17,000
Let's go all the way down to renderer.

26
00:01:18,000 --> 00:01:21,000
Find a certain layer over here.

27
00:01:21,000 --> 00:01:24,000
Let's change it to player and set it to minus one.

28
00:01:24,000 --> 00:01:28,000
So it will be always behind the player but in front of everything else.

29
00:01:29,000 --> 00:01:29,000
Good enough.

30
00:01:29,000 --> 00:01:33,000
We can go to material now and change it to a sprite default.

31
00:01:33,000 --> 00:01:36,000
Now it looks more like a pixels like what we need.

32
00:01:36,000 --> 00:01:38,000
Let's go all the way above.

33
00:01:38,000 --> 00:01:42,000
And I think that can the big so we can make them much smaller.

34
00:01:42,000 --> 00:01:45,000
We can do that by changing start size to point.

35
00:01:46,000 --> 00:01:47,000
To.

36
00:01:48,000 --> 00:01:48,000
That's good.

37
00:01:48,000 --> 00:01:54,000
Now we can see that our particles are spreading all the way around, and we need to keep them at one

38
00:01:54,000 --> 00:01:55,000
place to do that.

39
00:01:55,000 --> 00:02:00,000
We can go to shape over here and change this shape from cone to box.

40
00:02:00,000 --> 00:02:02,000
Now they all in the same box.

41
00:02:02,000 --> 00:02:05,000
And what I want to do here is to change the size of this box.

42
00:02:05,000 --> 00:02:11,000
And when I place it at the feet of the character and change scale on the Y to basically zero.

43
00:02:12,000 --> 00:02:13,000
Good.

44
00:02:13,000 --> 00:02:17,000
Now there are particles and they move in, but they move in to a different direction.

45
00:02:17,000 --> 00:02:18,000
So we cannot see it.

46
00:02:18,000 --> 00:02:22,000
What we need to do is to make them move up and left.

47
00:02:22,000 --> 00:02:25,000
We can do that by changing velocity over lifetime.

48
00:02:25,000 --> 00:02:27,000
Let's click it here.

49
00:02:27,000 --> 00:02:29,000
Let's find it Velocity over lifetime.

50
00:02:29,000 --> 00:02:37,000
Open it and we're going to change the speed of the X to minus one and speed of the Y to something like

51
00:02:37,000 --> 00:02:37,000
two.

52
00:02:38,000 --> 00:02:41,000
Now it goes up and left and that is good.

53
00:02:41,000 --> 00:02:42,000
Pretty much looks like a dust.

54
00:02:42,000 --> 00:02:47,000
What we want to do next is to go above and make them exist for less time.

55
00:02:47,000 --> 00:02:54,000
Because now you can see they are flying high and we need just a short burst of the particles.

56
00:02:55,000 --> 00:02:59,000
We can do that by change in duration from five to something like point five.

57
00:02:59,000 --> 00:03:04,000
And I want to uncheck looping over here and uncheck play on Awake.

58
00:03:04,000 --> 00:03:07,000
Now, particles will be there only when you play them.

59
00:03:07,000 --> 00:03:09,000
Let's try this play.

60
00:03:09,000 --> 00:03:12,000
It's going to fly like that and it looks more like what we need, right?

61
00:03:12,000 --> 00:03:14,000
Just a short burst.

62
00:03:14,000 --> 00:03:16,000
If you click restart, it's going to be there again.

63
00:03:17,000 --> 00:03:21,000
We can make more of them by changing emission over here.

64
00:03:21,000 --> 00:03:22,000
Let's go and do that.

65
00:03:22,000 --> 00:03:27,000
And we can set value to really high to something like 100.

66
00:03:27,000 --> 00:03:28,000
Let's see this now.

67
00:03:29,000 --> 00:03:31,000
This is more like a dust.

68
00:03:31,000 --> 00:03:36,000
And now we want to make it disappear with the time, because at the moment is just a bunch of white

69
00:03:36,000 --> 00:03:37,000
cubes there.

70
00:03:37,000 --> 00:03:43,000
What we can do is go to color over lifetime and change this color.

71
00:03:43,000 --> 00:03:46,000
And let's click it first open.

72
00:03:46,000 --> 00:03:52,000
And we can change color of a lifetime by clicking the bottom one and change it to something like red.

73
00:03:52,000 --> 00:03:56,000
Let's just see, for example, you see they turn in red with a time.

74
00:03:58,000 --> 00:03:59,000
Or.

75
00:04:02,000 --> 00:04:09,000
We can keep the color as it was, but change the alpha to make it transparent.

76
00:04:09,000 --> 00:04:12,000
And now you can see they disappear in.

77
00:04:13,000 --> 00:04:14,000
It looks much better.

78
00:04:14,000 --> 00:04:17,000
Now I want to lower duration time even more.

79
00:04:17,000 --> 00:04:19,000
I want to set it to point one.

80
00:04:22,000 --> 00:04:24,000
And this is really look like a dust.

81
00:04:24,000 --> 00:04:28,000
To make it fly faster because now it's kind of floaty.

82
00:04:29,000 --> 00:04:33,000
We can change simulation speed to something like three or four.

83
00:04:33,000 --> 00:04:34,000
Let's try it.

84
00:04:38,000 --> 00:04:38,000
I beat fast.

85
00:04:38,000 --> 00:04:39,000
So maybe to.

86
00:04:41,000 --> 00:04:42,000
Yeah, this looks better.

87
00:04:43,000 --> 00:04:46,000
And now let's try and play these particles when we need to.

88
00:04:47,000 --> 00:04:49,000
I'm going to make a child of the character.

89
00:04:52,000 --> 00:04:54,000
And more with Tumblr below.

90
00:04:54,000 --> 00:05:01,000
Let's go to player and I want to make another header for visual effects of the character header and

91
00:05:01,000 --> 00:05:02,000
we fix.

92
00:05:02,000 --> 00:05:06,000
And here we're going to do serialize field private particle system.

93
00:05:06,000 --> 00:05:07,000
That's the fix.

94
00:05:08,000 --> 00:05:08,000
Good.

95
00:05:08,000 --> 00:05:12,000
Now when we want to play dust when our player jumps, for example.

96
00:05:12,000 --> 00:05:14,000
So let's go and find John Button.

97
00:05:15,000 --> 00:05:19,000
And by the way, we can get in lots of same lines of code.

98
00:05:19,000 --> 00:05:22,000
So maybe we should modify script just a bit.

99
00:05:22,000 --> 00:05:23,000
Let's do this.

100
00:05:23,000 --> 00:05:26,000
Let's create a jump function over here.

101
00:05:26,000 --> 00:05:29,000
Private void Jump.

102
00:05:30,000 --> 00:05:37,000
I'm going to duplicate this line of code, paste it in here, but I want to pass jump force as a parameter.

103
00:05:37,000 --> 00:05:39,000
So force.

104
00:05:40,000 --> 00:05:43,000
And here instead of jump four is going to be force.

105
00:05:45,000 --> 00:05:50,000
Now we can cut out the music or the effect line.

106
00:05:50,000 --> 00:05:52,000
Paste it in here and now I will.

107
00:05:52,000 --> 00:05:56,000
Please just a jump function here and I'll pass it.

108
00:05:56,000 --> 00:05:57,000
Jump first.

109
00:05:57,000 --> 00:06:00,000
And for this one, we're going to do jump.

110
00:06:01,000 --> 00:06:03,000
And I'm going to pass double jump force.

111
00:06:05,000 --> 00:06:05,000
Cool.

112
00:06:05,000 --> 00:06:07,000
Now we only need to change.

113
00:06:07,000 --> 00:06:11,000
Jump once in the function and it's going to be fine here and there.

114
00:06:11,000 --> 00:06:12,000
Yeah, I like it more.

115
00:06:16,000 --> 00:06:21,000
All right, So here we can play the dust and dust fix Dot play.

116
00:06:21,000 --> 00:06:22,000
Pretty simple.

117
00:06:22,000 --> 00:06:22,000
That's it.

118
00:06:22,000 --> 00:06:24,000
That's all what we need to do.

119
00:06:24,000 --> 00:06:26,000
I think we could play dust when we slide in.

120
00:06:30,000 --> 00:06:31,000
So let's do it here.

121
00:06:31,000 --> 00:06:33,000
That's the picks that play.

122
00:06:35,000 --> 00:06:37,000
We need to assign dust effect, so let's do it.

123
00:06:39,000 --> 00:06:41,000
And in the play mode, we want to see how does it work.

124
00:06:41,000 --> 00:06:46,000
We still need to fix something, but we'll do it after we seen this one.

125
00:06:46,000 --> 00:06:49,000
So there is a dust and it's fine.

126
00:06:49,000 --> 00:06:55,000
Then the problem is we can see it's still child of the player and it stays in most together with the

127
00:06:55,000 --> 00:06:57,000
player, which looks really weird.

128
00:06:57,000 --> 00:07:01,000
What we can do here is to go to dust effect.

129
00:07:01,000 --> 00:07:02,000
I'll mute the game, by the way.

130
00:07:02,000 --> 00:07:09,000
We can go to dust effect, find simulation space and change it to world.

131
00:07:10,000 --> 00:07:13,000
And very same we need to do in the velocity over lifetime.

132
00:07:15,000 --> 00:07:16,000
Bald.

133
00:07:19,000 --> 00:07:20,000
Now it is much better.

134
00:07:20,000 --> 00:07:22,000
I'll try to do slide.

135
00:07:23,000 --> 00:07:24,000
I know.

136
00:07:25,000 --> 00:07:26,000
Well, particles were there.

137
00:07:27,000 --> 00:07:34,000
I wonder what if we change velocity of our lifetime to smaller value to something like -0.2 and for

138
00:07:34,000 --> 00:07:36,000
the Y point three?

139
00:07:38,000 --> 00:07:39,000
Let's see now.

140
00:07:40,000 --> 00:07:41,000
Yeah, this is better.

141
00:07:41,000 --> 00:07:42,000
We can increase simulation speed.

142
00:07:42,000 --> 00:07:43,000
Let's try.

143
00:07:45,000 --> 00:07:47,000
Yeah, this is much better.

144
00:07:47,000 --> 00:07:49,000
Let's keep this one.

145
00:07:50,000 --> 00:07:53,000
Now I feel like it would be nice to play particles on Linden as well.

146
00:07:53,000 --> 00:07:54,000
And we can do that.

147
00:07:54,000 --> 00:07:56,000
We just need to modify a script a bit.

148
00:07:56,000 --> 00:08:00,000
Let's go to the player script somewhere in the movie info.

149
00:08:00,000 --> 00:08:02,000
We can just create a boolean private ball.

150
00:08:04,000 --> 00:08:05,000
Ready to land.

151
00:08:06,000 --> 00:08:12,000
And we're going to set it to true when player is in the air and when he is, let's say, decrease in

152
00:08:12,000 --> 00:08:13,000
fallen.

153
00:08:13,000 --> 00:08:13,000
Yeah.

154
00:08:13,000 --> 00:08:14,000
So let's do this.

155
00:08:14,000 --> 00:08:16,000
Let's just do it in the update.

156
00:08:17,000 --> 00:08:25,000
If our velocity that Y is less than minus five and not as grounded then ready to land equals true.

157
00:08:25,000 --> 00:08:33,000
And then another if statement, if ready to land and is grounded, then we're going to play dust and

158
00:08:33,000 --> 00:08:34,000
dust fix.

159
00:08:36,000 --> 00:08:36,000
A play.

160
00:08:37,000 --> 00:08:39,000
And we're going to set ready to Land Falls.

161
00:08:40,000 --> 00:08:42,000
And we can wrap it in a function.

162
00:08:43,000 --> 00:08:47,000
There's something like check for land, check for landing.

163
00:08:48,000 --> 00:08:49,000
And let's move well below.

164
00:08:52,000 --> 00:08:52,000
Yeah.

165
00:08:53,000 --> 00:08:53,000
Here.

166
00:08:55,000 --> 00:08:57,000
But we are here to fix something else.

167
00:08:57,000 --> 00:08:58,000
Let's find our functions.

168
00:08:58,000 --> 00:09:03,000
I want to find just button and slide button, and I want to make it unavailable if player is dead.

169
00:09:03,000 --> 00:09:10,000
Because now we accessing these buttons from another place, from the buttons on the UI.

170
00:09:10,000 --> 00:09:12,000
So we need to do if it is dead.

171
00:09:13,000 --> 00:09:14,000
Then return.

172
00:09:15,000 --> 00:09:16,000
Same here.

173
00:09:18,000 --> 00:09:21,000
We can do if sliding or is dead.

174
00:09:21,000 --> 00:09:22,000
Then return.

175
00:09:24,000 --> 00:09:25,000
Okay, let's do it.

176
00:09:25,000 --> 00:09:26,000
Let's see the landing.

177
00:09:26,000 --> 00:09:26,000
Yeah.

178
00:09:26,000 --> 00:09:28,000
There is a dust on landing.

179
00:09:28,000 --> 00:09:33,000
If you feel like it's too much, maybe you can remove it on the double jump or make less emissions so

180
00:09:33,000 --> 00:09:34,000
it's less of them.

181
00:09:35,000 --> 00:09:37,000
It's all up to you and up to your feeling.

182
00:09:37,000 --> 00:09:39,000
All right, let's go to the next video.

