So I slowly got to know how to manipulate particle system and emitter in-game through the code, but there is one simple task I can't get to know how... How can I spawn particles ONLY when I hold the mouse button? I tried a work-around by setting the maxCount of emmiter to 0 when its not pressed but then it either doesnt emit particles at all, or just makes the existing ones disappear immidiately, which looks very unnatural and I don't want it. Is there a way to emit them "manually" in render method?
You probably want to do set the Emission scaled value on the particle emitter. You can leave the max count at whatever maximum particle number you want.
To turn off the creation of particles:
emitter.getEmission().setLow(0);
emitter.getEmission().setHigh(0);
To turn it back on:
emitter.getEmission().setLow(10);
emitter.getEmission().setHigh(10);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With