Let’s say you have a bullet, falling rock, thrown bomb, etc. that upon collision explodes into particles via Godot’s GPUParticle3D Node.
Is it better to:
-
have the the GPU Particle Node embedded within the bullet, falling rock, thrown bomb that is activated upon a detected collision; or
-
upon a detected collision, have a signal emitted out that is heard by some GameManager that adds the particle node/scene to the correct global position of that object?
Thank you!
1 Like
I prefer this method. The object should be in charge of it’s own particles.
3 Likes
Adding to gertkeno’s answer: If you want to re-use particle effects (e.g. same debris effect for different types of bullets hitting a wall), you can also put them into a scene that gets instantiated by the bullet on impact.
If you want the bullet to queue_free
on impact, the bullet can still instantiate the effect scene and add it to the scene tree via add_sibling
. That way, you still have a self-contained bullet but can free resources (e.g. physics objects) as soon as they are no longer needed.
2 Likes
Thank you both! Very helpful feedback. Definitely a good use case for an object pooler too.