accelerate only on postive dt

This commit is contained in:
Josh Wilson 2006-07-20 15:25:02 +00:00
parent 88e3d2c21d
commit 42b2b2d254
1 changed files with 17 additions and 15 deletions

View File

@ -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()