I didn’t think this would be so hard to do…
I want to spawn beams within a beam-emitter inside of a particle system component to represent rays fired from a rifle’s muzzle. I want the system to spawn no beams unless I tell it to, triggered by some “gun fire”-function. I want beams to potentially exist at the same time, just like ordinary sprite particles. Imagine a kind of laser-minigun, where beams spawn and de-spawn all the time.
The first problem is that it doesn’t seem possible to prevent the system from spawning at least 1 beam at any time. I guess I can work around this by letting the system deactivate itself when there shouldn’t be any beams at all at the time, and use the initial beam after activation instead of trying to spawn one manually.
The second problem is that there also doesn’t seem to be a way to disable the rate-based spawning of particles. Normal particles accept that zero spawn rate means zero spawn rate. Beam particles seem to believe that zero means infinite. I guess I can work around that as well by using code immediately after activation of the particle system (there is a bool to “halt” particle spawning in emitter instances for example), although it’s getting kind of hacky and I’m wondering why something so basic should require so many workarounds.
The third problem is that beams that I spawned from code (when system is already active and there’s at least one other active beam) using EmitterInstance::ForceSpawn(…) behave strangely. I think there’s something wrong with the sorting of particles and their corresponding source/target-points that makes it look like younger beams de-spawn while older beams stay forever. I am currently working on this, but seriously: Isn’t there an easier way?? I mean, what I’m trying to do here is kind of trivial and should have an out-of-the-box solution, no?