diff --git a/components/nifosg/particle.cpp b/components/nifosg/particle.cpp index c4bf69579..59a4a981b 100644 --- a/components/nifosg/particle.cpp +++ b/components/nifosg/particle.cpp @@ -238,7 +238,12 @@ void Emitter::setCounter(osgParticle::Counter *counter) void Emitter::emitParticles(double dt) { + int n = mCounter->numParticlesToCreate(dt); + if (n == 0) + return; + osg::Matrix worldToPs; + // maybe this could be optimized by halting at the lowest common ancestor of the particle and emitter nodes osg::MatrixList worldMats = getParticleSystem()->getWorldMatrices(); if (!worldMats.empty()) @@ -271,8 +276,6 @@ void Emitter::emitParticles(double dt) emitterToPs.orthoNormalize(emitterToPs); - int n = mCounter->numParticlesToCreate(dt); - for (int i=0; icreateParticle(0);