0 votes

Hello! I found out that GPU Particles2D emit only when they're visible. For me this is a problem because when i spawn an explosion particle out of camera's view and go over to it later, the particle just starts to emit, but it should be over. This doesn't happen when I use CPU Particles2D. Here's video

Godot version 3.2.3 mono
in Engine by (12 points)

1 Answer

0 votes

I think you can workaround this by making sure that you queue_free() those explosion nodes regardless, but you have to know the time it takes for the explosion to fade out:

# explosion.gd

extends Particles2D

func _ready():
    # Assuming explosion is momentary, not needed for smoke-like effects.
    one_shot = true 
    # Start emitting.
    emitting = true

    # Adjust the time it would take for the explosion to fade out.
    var seconds = lifetime * 2 # Can be different...

    # Create a timer and delete node once particles are finished emitting.
    get_tree().create_timer(seconds).connect("timeout", self, "queue_free")

Unfortunately, there seems to be no built-in signal which allows you to do this for one_shot particles, so that's the only way I can think of to solve this problem.

by (1,350 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.