From 42b2b2d254e2f308ed6e8122248c12a95eba07d5 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Thu, 20 Jul 2006 15:25:02 +0000 Subject: [PATCH] accelerate only on postive dt --- direct/src/particles/Particles.py | 32 ++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/direct/src/particles/Particles.py b/direct/src/particles/Particles.py index 14cfb0e869..8d0f4b63b1 100644 --- a/direct/src/particles/Particles.py +++ b/direct/src/particles/Particles.py @@ -564,19 +564,21 @@ class Particles(ParticleSystem): def accelerate(self,time,stepCount = 1,stepTime=0.0): - if stepTime == 0.0: - stepTime = float(time)/stepCount - remainder = 0.0 - else: - stepCount = int(float(time)/stepTime) - remainder = time-stepCount*stepTime - - for step in range(stepCount): - self.update(stepTime) - base.physicsMgr.doPhysics(stepTime,self) - - if(remainder): - self.update(remainder) - base.physicsMgr.doPhysics(remainder,self) - + if time > 0.0: + if stepTime == 0.0: + stepTime = float(time)/stepCount + remainder = 0.0 + else: + stepCount = int(float(time)/stepTime) + remainder = time-stepCount*stepTime + + for step in range(stepCount): + base.particleMgr.doParticles(stepTime,self,False) + base.physicsMgr.doPhysics(stepTime,self) + + if(remainder): + base.particleMgr.doParticles(remainder,self,False) + base.physicsMgr.doPhysics(remainder,self) + + self.render()