I'm adding some particle trails to projectiles in my game Fortifend (please excuse the placeholder texture):

I created a GPUParticles3D node for this purpose. When I call the emit_particle() function, I can set the origin point and velocity of the particle.

At the time of creation, I know how long it will take for the projectile to reach its target. So I can set the lifetime of the trail particle to this value using the 4th channel of the custom color passed to emit_particle(). This makes the trail wink out of existence exactly when the target is struck, which looks bad.

Is there any way to make the trail fade out cleanly? I also want to avoid the trail particle penetrating past the target, because then it would sometimes be seen passing through the terrain.

Thanks in advance for anyone who can help!

You could always make a custom animation with Animation player to trigger when it hits the enemy. That way you can dial in the time to where you need it.

    SnapCracklins

    I originally wanted to use GPUParticles3D particle trails for performance reasons, but I gave up on them because of the issue I described above. I went with the alternate solution of just attaching a trail mesh to each projectile and animating it scaling in/out with tweens: