Need help understanding why Particle2D trail is spawning particles in unexpected location

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TheJollyReaper

I made a dash trail using a particles2D node. When the dash button is hit, the particles node becomes visible and is supposed to leave behind ghosts of the player until the dash effect ends. It works perfectly the first time, and sometimes the 2nd time, but the location of the ghost trail becomes increasingly crazy and wrong as the number of dashes I do increases.

In my particles 2D node basically every possible setting is checked off or at zero.

Video of trail

can you unprivate the video? i’d like to answer your question

dustin | 2020-06-23 04:28

Whoops my bad. Should be working now

TheJollyReaper | 2020-06-23 04:31

ok, i get the problem now

dustin | 2020-06-23 04:35

:bust_in_silhouette: Reply From: dustin

So what I think you’re doing is that you’re hiding the dash particle node when you dont need it, and you show it when necessary. (i assume you’re also setting the “emmiting” property to true only when necessary.)

The reason why the trail particles are going in random places, is because they are staying where you put them when they’re first created. So everytime you show the particles node, instead of it showing where you were a second ago, it shows you where you were the last time you “dashed”

A better solution would be to set the “one shot” property of the particles node and to only set the “emitting” property to true when you press the dash button. this way you dont have to hide the node, neither do you need to set emitting to false, as it automatically stops emitting as soon as all the particles go away.

hope this fixes your problem!

yup that worked perfectly! Thanks!

TheJollyReaper | 2020-06-23 04:49

glad i helped!

dustin | 2020-06-23 04:55