‫So our goal for this video is to have smoke trails attached to our projectile and following it as it
‫flies throughout the world.
‫And this will make our projectiles look quite a bit cooler.
‫Hey, welcome back.
‫So we have hit particles, but now we'd like a particle system to follow behind the projectile as it
‫flies throughout the world.
‫So let's talk about how we're going to do this now for this particle system.
‫We're going to add a component to the projectile class.
‫Now, we've already added a variable called hit particles and its type is you particle system pointer.
‫Now, this is not a component.
‫It's simply a U particle system that we use when we call spawn emitter at location.
‫So spawn emitter at location does the creation for us dynamically at runtime in the on hit function.
‫But for a smoke trail, we're going to use something called a particle system component.
‫The particle system component is an actual component that we're going to create in the Projectiles constructor
‫using create default sub object.
‫And we're going to attach this to the root component so that it can follow the projectile around.
‫Now, the U.
‫Particle System component has a variable called template.
‫This is something that we set in the blueprint.
‫Remember when we had static mesh components and in the blueprint, in the details panel for the static
‫mesh component, there was a variable called static mesh and that had a dropdown allowing us to set
‫the static mesh for that static mesh component.
‫The particle system component has a similar variable, it's called template, and this will allow us
‫to use a dropdown to set the particle system for this particle system component.
‫So you already have experience creating components.
‫This process is no different.
‫So this will be your challenge.
‫You're going to add a you particle system component pointer variable to the projectile class, make
‫it visible anywhere so we'll have access to its properties in the blueprint.
‫Create this in the projectile constructor, which means you're going to use create default sub object
‫choosing the correct type and including the correct header.
‫I'm going to leave it up to you to search the documentation for the include for the new particle system
‫component type.
‫Once you've created it, attach it to the root component.
‫We've already seen how to attach components to other components.
‫Now go ahead and compile your code and open the Blueprint Editor and in the projectile blueprint, select
‫our new particle system component.
‫And in the details panel, set the template using the dropdown and you're going to choose the P underscore
‫projectile trail as the particle system for this component.
‫So pause the video and create this particle system component now.
‫Okay.
‫So I'm here in vs code and I'd like to close out of the classes I'm not using and go into projectile
‫h and here is where I'm going to add the particle system component.
‫Now I'm going to forward declare this and it's going to be U particle system component pointer and I'm
‫going to call this trail particles since this will be a smoke trail.
‫Now I'm going to give this a U property and make it visible anywhere as is done with our components
‫typically.
‫And I'm going to give this a category and I'll add this to the combat category.
‫So we have a U.
‫Particle System component pointer.
‫It's time to construct this in the constructor.
‫So let's go to projectile CP and scroll up to the constructor and we can add this here.
‫So we're going to say trail particles and use create default sub object using U particle system component.
‫And in the parentheses I will give it some text and call this smoke trail.
‫Now I'm going to need the include for you particle system component.
‫So I have my documentation.
‫I'm simply going to search for you.
‫Particle system component.
‫And click on you particle system component scroll down and here's the include it's in particles slash
‫particle system component H.
‫So I'm going to include that here at the top just under gameplay statics.
‫So I've created my trail particles.
‫I now need to attach them to the root component.
‫So I'm going to say trail particles using setup attachment and I'm going to attach this to root component
‫and now it's attached.
‫So we've created our trail particles and we've attached them to the root.
‫Let's go ahead and compile this now.
‫We're back here in the editor.
‫I'm going to open up BP projectile and here is my trail particles and it's parented to projectile mesh,
‫which is the root.
‫So I'm going to select trail particles.
‫And here in the details panel, I see the template variable.
‫It's under particles.
‫I can select the dropdown and choose projectile trail.
‫So that will set our projectile trail particle system.
‫And if you were curious what projectile trail looks like, we can go back to Asset's Effects and double
‫click Projectile Trail.
‫We took a look at this early on in this section and we saw that this is what it looks like.
‫So this is the particle system that will be attached to the root component.
‫And as you'll notice, it's designed to keep looping.
‫So it's going to keep playing as long as it exists in the world.
‫So let's go ahead and test this out.
‫I'm going to go ahead and hit play and as soon as I can, I'm going to shoot some projectiles and check
‫that out.
‫This looks amazing.
‫Our projectiles now have a smoke trail and if we go and aggro the enemies here, we'll see that their
‫projectiles have smoke trails as well.
‫Perfect.
‫So in summary, we now have smoke trails and our projectiles look quite a bit better.
‫Now, we still need a few effects and we're going to take care of those in the videos to come.
‫I'll see you soon.