diff options
-rw-r--r-- | src/particle/particle.cpp | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index de85d2a59..8ebde0a2b 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -291,25 +291,32 @@ bool Particle::update() restrict2 } updateSelf(); } - } - - const Vector change = mPos - oldPos; - if (mChildParticles.empty()) - { - if (mAlive != AliveStatus::ALIVE && - mAutoDelete) + const Vector change = mPos - oldPos; + if (mChildParticles.empty()) { - return false; + if (mAlive != AliveStatus::ALIVE && + mAutoDelete) + { + return false; + } + return true; + } + for (ParticleIterator p = mChildMoveParticles.begin(), + fp2 = mChildMoveParticles.end(); p != fp2; ) + { + // move particle with its parent if desired + (*p)->moveBy(change); } - return true; } - - for (ParticleIterator p = mChildMoveParticles.begin(), - fp2 = mChildMoveParticles.end(); p != fp2; ) + else { - // move particle with its parent if desired - (*p)->moveBy(change); + if (mChildParticles.empty()) + { + if (mAutoDelete) + return false; + return true; + } } // Update child particles |