I have a laser beam represented by a particle system in a sidescroller. The way I have it set up now is that it gets created, and then its source and target points change depending on character and mouse position.
The problem is I can’t seem to be able to delete it before it completes its loop(s).
I tried “Destroy Component” on the Particle System and it didn’t seem to work.
I know I can set the number of loops and emitter duration in the Required Tab in the Particle System Editor. However I would like to be able to kill it as soon as the player releases a key. You know, like toggling a laser sight in a gun.
I have thought about creating and deletign particle systems with very short lifespans every frame but that seems pretty inefficient to me. Is there a way to deactivate a particle system on demand?
Alright so I replaced Spawn Emitter Attached with Spawn Emitter at Location, and it seems to work correctly now. Still
not sure why it wasn’t working with the emitter attached to the gun.
Glad to see that you got everything working the way you wanted. As a tip, it would be more efficient to turn the emitter off/on each time rather than having to destroy/create the particle system each time the player releases/presses the button.
Thanks for the tip. I tried turning off the emitter by using the “Set Emitter Enable” function, however there is about a second of delay between the button release and the emitter dissapearing. I thought it was maybe to do with the “emitter duration” value which I changed from 1 to 0.1, but still the same.
Any idea where I’m going wrong?
Not sure what to say off the top of my head but I can look into it. What do you have set for the lifetime and spawn rate of the particle?
I tried playing around with those values, decreasing the rate to 0.1 seemed to increase the time the laser beam stayed around after the button release. I tried increasing it to 200 it didnt seem to change much. I’m new to the whole particle editor thing I think I’m just not understanding the values correctly.
I’m gonna look at some tutorials
We have not heard from you in a few days. I hope you were able to solve your problem with deactivating your particle system on demand. I am marking this post as resolved for tracking purposes, however feel free to respond to this message if you are still experiencing the same issue.