Everything to Know About PARTICLES in Godot 4

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey so particles in Goa are pretty cool and easy to use and in this video well I wanted to go over everything there is to know about the particle 2D node from an explanation of important things to know and then at this Tim stamp we will create different in-game examples like fire rain and explosions but before we get started if you could subscribe and drop a like on this video to help YouTube push this tutorial to more aspiring game devs than it would mean the absolute world to me but how does the particle node work so first of all there are two different nodes the GPU particle 2D and the CPU particle 2D and most of the time you're going to want to use the CPU particle 2D unless you're wanting to spawn tons of particles because in that case and you want to use the GPU particle 2D since it uses the GPU and in turn will help the game in performance if you're using a CPU particle 2D then you may see a dip in performance when spawning a high number of particles because it won't be used in the GPU so particles can be used for so many different things from explosions fire rain and so much other stuff and I want to take the time here to go over how to create those different effects step by step and explain the inspector and all the options the particle node has so you're able to go and create anything that you need with a particle node so let's get started by creating an explosion effect and to do this we're going to create a 2d scene and we can just name this scene the explosion because that's what it's going to be that's the effect that we're going to create and we're going to go here and then we're going to add a particle 2D so CPU particle 2D is what we're going to be using and you can see that we're already spawning particles but for an explosion well there's going to be a couple things that we're going to have to change like the gravity right so if we come to the gravity and we click it to zero you're going to see it's going to stop falling completely if we set it to a negative number well you're going to see it's going to go up if we set it to a number it's going to go down right and we want to at zero for an explosion because we want it to go in all the directions we don't want it to tell in a certain direction you know a certain amount so we won't do that and then we're going to go into time and for an explosion there's this explosiveness little number here and this obviously as of now doesn't do anything but if we turn our gravity up let's say we have our gravity at 100 you're going to see that when we change explosiveness how it works right so that's going to release them at different times but this is going to release them all at once so that has eight particles and each one of these particles you see that's eight particles falling and that's what we want for an explosion right but we're going to want them to all go at the same time and go different ways but we're going to want them to be different sizes right so to do that we can come down here to the scale and we can change scale and you can see this is going to be scale too they're all going to be scaled up to two or if we go to four you're going to see it's going to choose a random scale but we're going to actually have to change this explosiveness so we can see it you can see that they're all different sizes right all of the pieces are different sizes we're going to turn explosive this off for now but you can see they're all different sizes and if we want them to fade and get smaller right cuz now they're all just going to disappear and they're going to be solid the whole time if we want them to like get smaller as they go down well because like an explosion you're going to want it to get smaller you don't want it to stay the same size the entire explosion we can come down here to our scale and we're going to have a scale amount rank here and if we click a new curve can click on it and if we right click at number one well it's going to stay the exact same because whenever it spawns whenever it spawns in it's going to be equal to times one of its scale so so the number is going to stay the same but if we come down here then it's going to be equal to times right it's going to fade and it's going to go down here and it's going to be equal to whatever this is so maybe this is like times 2.5 of of the fade right so it's going to take this number and it's going to go to 2.5 times whatever its original scale is and it's going to get smaller as it goes down as you can see if we go all the way up well it's going to stay the same if we come down well it's going to fade into absolutely nothing but we'll go somewhere around this area just like that and it doesn't really look good now but it will look good here in a second if we fix up some stuff so let's change gravity back to zero let's go back up to the top let's turn on our explosiveness up to a lot you know the biggest that it can do and then in our Direction I want to go here where's our Direction I want to go here and I want to move this spread up and then we're going to go into our initial velocity this is the one that matters the most this is what's going to actually be the uh entire movement if we set this to we'll say 50 you're going to see that it has a little explosion but they are all going to go the exact same distance if we set the max of it let's set the max let's set the minimum velocity to 50 and then let's set the maximum velocity to 100 you're going to see now some of them are going to go farther than than others right and that's what we're going to want for a little uh explosion and it looks like an explosion but there's not many particles so if we go up here to the top we can set the particles to about 60 and you're going to see how that and you can kind see that these go forever and they look very very like this is a big this is like a firework this is a huge explosion so to fix this we can go to our lifetime we can cut that in half you're going to see it's a quicker explosion it's quicker and it's it's more dense and it's right there and that looks like a pretty good explosion maybe we can up the the particle amount but you don't really need to up the particle amount cuz I think it looks pretty good at 60 not 6 not six but 60 and then that looks good so now if we go and we add a script T an explosion we can add a script here and this script is going to basically just turn on and off our explosion so all this is going to do is if we click enter it's going to turn the explosion on so we can say input. is action just pressed UI accept and we can say something like the CPU particle 2D do emitting is going to equal to true we can save the scene and we can save the script we can go to our particle 2D here and we are going to go to our time one more time we're going to turn this to one shot because as you can see if it's on one shot well we're going to have to turn emitting on for it to explode then emitting is going to go off automatically on its own if it's not on one shot and emitting is on it's going to just keep looping and over and over so if we turn one shot on just like this and then we go and we play the explosion scene every time we click enter you're going to see it's going to be way up here because it's going to be kind of small so to fix that camera 2D set the camera 2D Zoom to five and if we play and we click enter you're going to see that is a explosion and that looks pretty good for an explosion so that's how you create an explosion but but now let's go and let's create a fire effect okay so the fire effect is going to be a little bit more complex and to create this we're going to go up here we're going to create a new scene we're going to make a 2d scene and we can just name this fire so fire is going to be much much more complex than the uh the last one we're still going to use a CPU particle system here and on the CPU particle system we're going to have a bunch of different stuff so first of all our gravity we're going to want it to go up right it's fire so gravity if we set it to like 600 you're going to see now the gravity is going to go up and our particles are going to also go up at the same time now you can kind of see it emits from exactly one point so if we go to our emission shape we can change our emission shape to a rectangle if it does that then let's say we expand it you kind of see that it's going to expand all around that's how we're going to create rain but from a rectangle we do not want a rectangle we're going to go make a spear and a spear is going to have a spear so if we change the radius here and we can change the radius to maybe like 10 you can kind of see see that it's all going to come out from around this area down here and well for this it's going to be a pretty big amount of particles so maybe like 2,000 so this is going to be a lot of particles right and you can kind of see how that looks that kind of looks like what the Prototype kind of looks like just a little bit we can go down here we can set our lifetime to maybe 0.5 so it's more dense and it doesn't go up as high because we don't want it to go up that high and then we're going to have some other stuff if we want it to come inwards like this we can have it push inwards so it looks like it's all going up towards one point and that would be radical Excel down here so if we turn this up we can say maybe the max I mean the minimum is -40 and maybe the max is 40 or 50 and 40 right so50 and4 you can kind to see that just so we have a little bit of different differential here you kind to see how it goes up just like this but what makes fire fire is first of all the scale we want it to shrink as it goes up so we can go fix that real quick we can come down here to the scale but then we're going to change the color and the color is going to be kind of complex right because we're going to have a gradient and it's going to fade into different colors but the scale we can say it can either be from 0. five or it can be to I don't know maybe I guess two so it looks more dense right they're bigger particles and they are or they could be smaller particles so they could be bigger or they could be smaller we'll we'll leave this at 0. five I think that's fine and then we're going to do the same thing that we did on the explosion we're going to create one of these ranks and we're going to come down to where it fades not we don't want it to as much as the other one maybe like4 around here and you can kind of see that looks like fire the only thing that we are missing is the color right so if we come down here we go to color and we change the color rant rant to new gradient well we can click on this and we can change up all these colors you can kind of see how this looks now that doesn't look too good but we can say the first color here is going to be black we want this to maybe be some sort of red and how would we make a nice looking red for a fire maybe we'll stick with this right so maybe we'll go with this and then we can add a new Point here and this point is going to be a little bit of a change this point is going to be more towards the orange side right a red orange color just like this maybe more orange yeah maybe something maybe something like this right and then we're going to add another point this point is going to be more yellow orange so if we get make sure we have full orange we can come more onto the yellow side like this right that's going to be more of a yellowish yellowish orange then we can come down here and we can make this color here completely transparent just like this so it's it's going to fade away at a better it's going to have a better flame then we can change this also to transparent because we don't really need that one I didn't know that was even there or we would have just moved it forward a little bit but you can kind of see how this looks and the higher you want the SM smoke the more you move this transparent backwards and the higher the smoke will go so maybe right there maybe that looks good right and that kind of looks like fire maybe we have to change up the red a little bit to make it a little bit more orangish off the start so it's not as big of a of a change or maybe we can change this one up more towards yellow something like this right that's going to be fire obviously you can play around with this you can change it up to however you want it maybe we can make this more orange something like this and that's going to be fire that that's that's fire that looks good now real quick I want to create a toggle so we can come up here well first of all I guess we can add a camera 2D and the camera 2D we can set the zoom to five then we can go here and we can add a script and this script is going to be basically the exact same we'll just say if input. is action just press UI accept and then we'll we'll create a quick toggle and this toggle will be CPU partic CPU particles. emitting equals not that of CPU particles. emitting right and we can save the scene save the script and then if we come back to the 2D scene you're going to come all the way up to the top we don't want it on one shot and emitting it can be emitting to start that's fine if we click play you kind of see it looks more like a fire right that's how we would create a fire we can turn it on turn it off turn it on turn it off just like fire should be be able to you know turn on and off and that looks pretty good that looks very very nice right so that's going to be a fire now we're going to go and create the very last effect which is going to be rain right and as we're going through this tutorial hopefully you're seeing how all the settings work and how all the settings function the best way to learn about the particle 2D is to go through all of the inspector and just play around with it and make your own things with it so let's go create the rain real quick and that's going to be the last effect for this video okay so now quickly to create rain we'll go up to the top 2D scene and we're going to name this rain now this one should go a little bit faster right so now we're going to add a CPU particle and real quick just because at the end we're going to have to add a camera anyway we'll set the camera zoom to five and then we'll go up here to the rain and we're going to make the exact same as the fire script we'll say if input that is action uh just press UI accept and we'll say CPU particle 2D do emitting equals not that of CPU particle. Ting right save just like this okay Now to create particle 2D well what do we need this is rain right this looks like rain right well we want rain that's falling but we don't want to just to fall straight down because it's basic we wanted to have a little bit of a wind a wind thing right so it goes this way kind of and to do that we're going to have to play around with the uh the gravity right so the gravity if we go to the gravity this is all going to be gravity for the rain we're going to leave this at 980 that's fine we're going to change up the X gravity right so maybe 100 you're going to see how it's going to go an angle right that's going to be kind of angled maybe -200 just depends right so I think that's good but let's say if we have gravity at a th000 well I was going to say A th000 you can kind of see how it's going to go sideways if we have it at 2,000 which is going to be double of Y it should go more up and if we turn y completely off and set y to Zer it's going to go straight right so this is going to be 980 and we can go down here we can set this to maybe2 for now we can always come back and change it depending on how it looks and first of all the emission shape this is the big thing we're going to change this to a rectangle and we're we're going to want this to go along the entire way of the camera so maybe 100 I guess we're going to need a little bit more than 100 okay yeah you can see it spawns all the way out here maybe sometimes every once in a while it'll spawn all the way out here I just saw one and then it spawns all the way on this side as well so if we take our GPU part or CPU few particle I mean we move this up just like this so it's above the camera so it looks like it's falling into the screen right and then we have it on rectangle you can kind of see how it spawns all the way across now if we go up here change them out just so it's easier to see to 200 you can kind of see how it looks like rain maybe we move a little bit this way just because we got this bottom of the screen right so that's going to look a a little bit more like rain now this is going to go very far down right so we can come down here to the time we can change up the lifetime to maybe 0.5 no it has to be a little bit longer than 0.5 because it doesn't reach the bottom okay see now it goes all the way past and it hits the bottom so that's all we're going to need we'll have 200 that's going to make it look a little bit more dense though so maybe we can go to like 170 maybe 160 particles right and I guess I guess we'll go we go 150 particles right okay 150 particles that looks fine we'll leave it at this right so that's going to look good now the scale we want the scale we want the rain to stay small so we want it to be about this small or we can set the minimum to 0 2 right so now if the minimum is 0 2 they can only be the normal size or they can be even smaller than the normal size so it's going to be 0 2 to one so it's just going to pick and we don't really care anything about the scale because we want them to stay the same the entire time unless they're hitting the ground we're s you to have little animations playing based on however the rain would be going which will just have a background animation plan and that would be pretty easy to do but then we're going to go to our um color and we're going to change the color to make it some sort of color so we go to a Col we can just make it a straight color just like this instead of making like a gradient we're just going to want a color maybe we can go with a little darker bit of a blue something like this right and that's going to be our rain we can save the scene we can play the scene you kind of see that's rain we click enter rains off rains on rains off rains on and you kind of see that they're all different sizes so it looks like it gives depth perception to the rain and I think it looks very very very good so that is going to be how you create rain with a particle 2D that's also going to be how you create fire and explosion with a particle 2D just like we went and we created all of these other little things in here like fire which looks very nice and explosions which if we click enter explodes so that is how you use the particle 2D and that is the you know basics of it now the best way to learn like I said is to go through and just play around with all of the the uh settings over here in the inspector play around with every single thing and then you'll get to know it quick right so let's say we go to our fire and you know we change this right this is not going to do anything because this is a pre process but if we set the speed scale what's going to happen well that's going to look weird right maybe the explosiv this what's going to happen it's going to shoot up Flames maybe if we do a little less explosiv than this what happens see so just go around play with all the settings and see what happens to the items and you'll be able to understand how what things do and how things work if you want to learn more about particles and Goa then I'll leave a link to the official Goa documentation in the description below and it goes over everything very very well thank you so so so much for watching I really hope this video was able to help in some way and remember to subscribe and drop a like on this video to help you to push this video to more aspiring game developers who want to learn to make their own go to games as well and until next time stay safe and have a wonderful wonderful rest of your day [Music] byebye
Info
Channel: DevWorm
Views: 14,601
Rating: undefined out of 5
Keywords: godot, godot 4, particles in godot 4, particles, godot particles, godot particles2d node, how to make particles in godot, how to make explosion in godot, how to make explosion effect in godot, how to make fire effect in godot, particles in godot, particle system in godot, how to use the particles in godot, godot tutorial, everything to know about particles in godot, godot engine, how to use particles in godot step by step
Id: yWIH7hHfWyU
Channel Id: undefined
Length: 17min 28sec (1048 seconds)
Published: Thu Dec 21 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.