Skip to content

Add Pause property to particles

Rafał Mikrut requested to merge github/fork/malbach/pause_particles into master

Created by: malbach

Hi, This is just some fun I had with Particles3D, and thought it might be of use for some people. It adds a "Pause" checkbox under "Emitting" in the particles properties. If activated, the particles is 'paused', it stops moving. When deactivated, the particles... well, restarts (obviously 😁 ) As for all other properties, "pause" can also be used in scripts.

I made it for Particles3D and 2D, and I also added it to CPUParticles, it works but I'm not sure if I did it right (I simply copied the "set_emitting" function and renamed it to suit my needs, but as CPUParticles are WIP it might not be a good thing). In fact I added it to CPUParticles mainly to have a good compilation 😆

I also added a getter ("is_paused"), but I don't have a usecase for it... it's there if needed.

Here is a small project I used to test this. It contains 3 CPUParticles and 1 Particles3D emitting in front of a wall, and a moving omnilight is used to cast shadows onto the wall. When run, you can use SpaceBar to show/hide a small GUI, and in this GUI there is a checkbutton to pause/unpause the particles. When the GUI is hidden, you can move in the scene using mouse + arrows. test_Particles3D.zip

To test the Particles2D, I just used the 2D Particles Demo.

Merge request reports