Code: Select all
m_emitter->setMinParticlesPerSecond(0);
m_emitter->setMaxParticlesPerSecond(0);
However, there is a bug when doing this : if the particle emitter was paused during 10 seconds, when you resume it, it suddenly fires 10 seconds' worth of particles all at once, producing a dense cloud of particles. (This is because the current implementation tracks the elapsed time between two calls to "emitt", but "emitt" does not seem to be called when the emitter is paused.
Find below a patch that corrects this issue :
Code: Select all
Index: Irrlicht/CParticleBoxEmitter.h
===================================================================
--- Irrlicht/CParticleBoxEmitter.h (revision 3516)
+++ Irrlicht/CParticleBoxEmitter.h (working copy)
@@ -42,11 +42,26 @@
virtual void setDirection( const core::vector3df& newDirection ) { Direction = newDirection; }
//! Set minimum number of particles emitted per second.
- virtual void setMinParticlesPerSecond( u32 minPPS ) { MinParticlesPerSecond = minPPS; }
+ virtual void setMinParticlesPerSecond( u32 minPPS )
+ {
+ MinParticlesPerSecond = minPPS;
+
+ // if 0, "emitt" will no longer be called, so stop counting time since last call
+ if (minPPS == 0)
+ Time = 0;
+ }
//! Set maximum number of particles emitted per second.
- virtual void setMaxParticlesPerSecond( u32 maxPPS ) { MaxParticlesPerSecond = maxPPS; }
+ virtual void setMaxParticlesPerSecond( u32 maxPPS )
+ {
+ MaxParticlesPerSecond = maxPPS;
+
+ // if 0, "emitt" will no longer be called, so stop counting time since last call
+ if (maxPPS == 0)
+ Time = 0;
+ }
+
//! Set minimum start color.
virtual void setMinStartColor( const video::SColor& color ) { MinStartColor = color; }