Jump to content

[SOLVED] When to destroy particle systems with finite lifetimes


photo

Recommended Posts

Hello,

After instantiating a particle effect that isn't tied to a persistent object and lasts a finite amount of time (for example, sparks when a bullet hits a wall), how do I know when to destroy it? There doesn't appear to be any sort of property or callback in the ObjectParticles interface that could be used to determine whether it's no longer emitting particles. The Third Person Platformer demo in the SDK just loads a node, places it and forgets about it, which is fine for a demo, but having an unbound number of no-longer useful nodes remain in memory until potentially the end of time strikes me as something that would cause problems eventually. I tried writing a function that tries to calculate the total lifetime of a node from the properties of the ObjectParticles it's made up of, but because there are multiple ways of preventing it from running forever and most effects are made up of multiple emitters, some of which may be synced to others, it's difficult to make robust.

Is there anything I missed in the API or am I just going about this the wrong way?

Edited by Hakim
Solved
Link to comment

So it basically boils down to either manually specifying the lifetime somewhere or using a fixed pool of nodes and using them as needed in a round-robin fashion? I suppose I was expecting something that could be extracted from the nodes directly, but those solutions are workable. Thanks!

Link to comment
  • Hakim changed the title to [SOLVED] When to destroy particle systems with finite lifetimes
×
×
  • Create New...