Particle System Trails | Unity Particle Effects | Visual FX

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys this is dem keys and today I'm going to teach you how to create trails using unities particle system now real quick I wanna mention that I've already done a tutorial on the basics of the particle system so if you wanna check that out the link is going to be in the top right corner and in the description down below that being said let's begin so first of all you need to change the layout of your editor to do that click layout and clicked all that's going to give you this layout that I'm currently in next right-click in the hierarchy and select particle system that's going to create a particle system game object for us and change the position to zero on all axes alright now before we continue I wanna mention that unity is particle system does have a trails module but in this tutorial I'm not going to be using the trails module at all I'm going to show you a different way to create trails using the particle system alright so first of all you're going to notice that these particles are going upwards so we want to apply some sort of gravity to these particles to do that change the value of the gravity modifier from 0 to 1 so now we have gravity being applied to these particles however you'll notice that when you move the particle system around all of the particles sort of move in in a sort of uniform motion that is because these particles are being simulated in the local space of the particle system to change that click simulation space and select world now the particles are being simulated in the world space so when you move the particle system around you're not going to have the problem that we had previously because these particles are being simulated in the world space alright next expand the emission module and you'll notice rate over time is currently set to ten rate over time basically lets you specify how many particles would be emitted per second change this to zero and set rate over distance to ten rate over distance basically lets you specify how many particles will be emitted per distance unit now that we have set rate over distance to ten when you move the particle system around only then you see particles being emitted all right now this is great and all but you'll notice that when you move this particle system around for too long eventually it cuts off and then continues again let me explain what's going on over here you'll notice this particles feel it keeps increasing and decreasing in value this is basically the amount of particles that are currently being simulated by this particle system and this particle system has a max particles property which lets you decide how many particles this particle system can simulate at any given time so once we move this around for some time eventually the particles reach 1000 so the particle system stops emitting particles until some the other particles died out now there are a couple of ways that you can solve this problem you could increase the max particles from 1,000 to something higher like five thousand and then you'll notice that you're able to move the particle system around for a longer time without it cutting off however you have to keep in mind that when this particle system is simulating a very high number of particles that can impact performance I'm going to set this back to 1000 another solution would be to set the rate over distance to something lower like three for example and now you'll notice that I'm able to move this particle system around for more time without it cutting off I'm going to change this back to ten and another solution would be to set the start lifetime from five to one this basically means that the particles will die out much faster and so that gives you this kind of an effect all right so now we have a nice trail sort of behavior going on with our particle system however you'll notice when I move this particle system on a horizontal axis you have a flat trail being created but when I move it on a vertical axis you have a ticker trail being created to solve this issue expand the shape module and change the shape from cone to sphere and now when you move the particle system around you have a different behavior even if you move it on a horizontal axis or a vertical axis also we're going to reduce the radius down to 0.01 and that's going to give us a thinner trail now you'll notice as I'm moving this particle system around the particles seem to be falling down if you remember earlier we had set the gravity modifier to 1 so there is gravity being applied to these particles change the gravity modifier to 0 and now when you move this particle system around you have a different sort of behavior with the particles all right so this is great but let's add some color to these particles enable the color over lifetime module and expand it and then open up the gradient in the gradient editor now real quick if you don't know about gradients these keys down here let you specify the color and the keys up here let you specify the Alpha which is a transparency you can add as many keys as you like and if you want to remove a key you can just drag it out so in our case we're going to add just one key in the middle one color key in the middle and select the first color key and set its color to a reddish orange select the middle key and set its color to a lighter orange and set the final color keys color to somewhat a reddish orange next we're going to create an alpha key up here and bring it a little towards this side and then select the last Alpha key and set its alpha value to zero so basic the effect of this is that was the end of its lifetime the particle will start to become invisible you can close the gradient editor and now when you move the particle system around you have this kind of behavior now for those of you who don't know you can actually create presets out of the gradients that you make to do that once you have created your gradient just click on new and that's going to create a gradient preset for you and if you want to delete it you can just right click and click delete now I have a gradient preset that I've made but you can pause the video and create this gradient and then continue and once you create this kind of a gradient you have this effect all right next we are going to increase the rate over distance from 10 to 13 and increase the max particles from 1000 to 5000 now we have thicker trails however you'll notice these particles have a certain amount of motion when they are first emitted to change that we are going to set the start speed from 5 to 0 and then when you move the particle system around you actually have a solid trail being created now this is great but notice the end of the trail it's not really thin it doesn't thin out towards the end to fix that we are going to enable the size over lifetime module enable the size of a lifetime module and expand it and enable this curve by clicking on it and then we don't have to do anything at the beginning of the curve but at the end if you don't have a key already created over here double click and a key should be created and then just select and drag that key down so basically the effect of this will be that the size of the particle is going to start at 1 and gradually reduce down to zero and the effect of that is this so now our trail is actually thinning out towards the end now we can further modify this to add let's say a magical effect to it to do that enable the noise module now before we continue any further I want to mention that the noise module does impact performance so be careful of how you use the noise module now that we have enabled the noise module when you move this particle system around you should already start to see a sort of magical effect in the trail I'm not sure what to call this that's why I'm calling it a magical effect but you get the point and we can further modify this behavior by changing the strength from 1 to let's say 3 point 5 this is the effect when you have a strength of 3.5 and I have just changed one property you can actually mess around with many of these properties and see the different kinds of effects that you can achieve but again be careful of how you use the noise module because it can actually impact performance now if you feel that Trail is dying out too fast if you want that magical effect to last a little longer you can increase the start lifetime to two and then it stays for a little bit longer you can increase it higher but then you might have to increase the max particles as well so that the trail doesn't randomly cut off all right so these are the different ways that you can use to make different kinds of trails using unities particle system without actually using the trails module alright so now we are going to take a look at a use case scenario by attaching this particle system to some sort of cannon ball and firing that cannon ball as a projectile right-click in the hierarchy click 3d objects here this is going to create a sphere game object change its position to zero on all axes and drag and drop the particle system into the sphere game object and change the particle systems position to zero on all axes as well you can rename the sphere to cannonball next add a rigidbody component to this cannonball game object also we are going to add a script called cannonball script open it up in monodevelop now the script is going to be really simple in the start method you call the destroy method we want to destroy this game object but after a certain delay we're going to give it a delay of maybe 5 seconds so 5 F hit save go back to unity and now you can drag and drop the Cannonball game object into the project panel basically making it a pre file next click game object 3d object queue change the position to 0 and all axes set the scale on the y-axis to 0.1 and on the X and z axis to 100 we're going to create a material and change the color of this ground so it's not so bright you can name the material anything and just set the color to something a little dull then drag and drop the material onto this game object so it's not really bright and now that we have made a prefab out of our Cannonball we can delete it from the scene next create an empty game object change the position to zero on all axes and drag it a little bit up so that it's not inside the ground this is what we are going to use as a cannon to fire our cannonball projector we're going to add a script to this called cannon script open it up in monodevelop now I want to mention this real quick this is not a tutorial on how to instantiate projectiles so I'm going to be going a little too fast over this if you want to learn how to fire projectiles I've done another tutorial on that the link is going to be in the top right corner and in the description down below so first of all public game object cannonball this is going to be our cannon ball game object that we're going to instantiate and then public float shoot force equals zero then in the update method type if input God get keydown Kiko dot space that means of the space key is pressed then game object projectile equals then within bracket start game object instantiate and we want to instantiate our cannonball game object we honor instantiated at the same position as our cannon game object so transformed our position the rotation can be the same as the cannons rotation so transformed out rotation and that's it next we are going to type projectile dot getcomponent rigidbody because we want to access the rigidbody component of this game object dot add force we want to add force to this projectile game object in its forward position so we're going to type projectile dot transform dot forward x xu force now hit save go back to unity alright so drag and drop the Cannonball game object into the cannon ball field of the cannon script and we're going to set the shoot force to something a little high like three thousand and just so that the projectiles are fired in an upward direction or diagonal I'm not sure how to say that I'm going to rotate this game object a little bit on the x axis so that its local z-axis is pointing in this direction hit play and when I press space the cannonballs are being instantiated along with the trails attached to them so yeah that's it this is how you can make krills using unities particle system without actually using the trails module i hope this video is helpful if you want to check out more videos head over to my channel and there should be two videos up on the screen right now as well don't forget to check out my music channel the link should be up on the screen right now if you want to help me out with the donation my paypal email address should be up on the screen and in the description down below don't forget to Like share and subscribe leave your comments below and I'll see you guys next time
Info
Channel: Abhinav a.k.a Demkeys
Views: 248,736
Rating: undefined out of 5
Keywords: unity particle trail, unity particle trails, unity trail, unity trail effect, unity particle effects, unity particle effect, unity visual effect, unity visual effects, unity particle system, unity vfx, unity vfx tutorial, unity tutorial, unity tutorials, visual fx, visual effects, visual effect, unity game development, game developer, game development, gamedev, unity 5, unity 5.6, particle system, particle effect, particle effects, shuriken, tutorial, demkeys
Id: agr-QEsYwD0
Channel Id: undefined
Length: 10min 25sec (625 seconds)
Published: Mon Jun 05 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.