Destroy particles attracted to player

I’ve made an emitter that spawns particles in a burst. An attraction force is applied, making the particles follow the player’s position. My issue is, how do I delete those particles that have reached the player? (or atleast make them invisible)

Hello @Sntfon100!

Here is the solution you’re looking for:


I’m assuming if you have an attraction force, then you’re already getting the player’s location, so you can just plug that in, then set a distance to kill.

Basically, this code is getting the length in UU between the player and the patricle, and if that length is smaller than the “Distance to Kill”, the particle dies.

Now, this logic will be enabled as soon as the particles are created. If your particles start close enough to the player, this will kill them instantly. In this case, you’ll need to add extra logic (like a Do Once) to make sure the particles get far enough away first before the kill can trigger. If this is the case and you need additional help, feel free to reply and I can provide some additional support.

2 Likes

Woah I gotta learn more about Niagara scripting, that’s so cool!
Thank you so much for the help, it worked perfectly!