Fix for divide by zero error

This commit is contained in:
Greg Wiatroski 2007-04-20 23:26:53 +00:00
parent d9dcbfc429
commit 3b57b93a98
1 changed files with 5 additions and 1 deletions

View File

@ -573,7 +573,11 @@ class GravityWalker(DirectObject.DirectObject):
onScreenDebug.add("__oldDt", "% 10.4f"%self.__oldDt)
onScreenDebug.add("self.__oldPosDelta",
self.__oldPosDelta.pPrintValues())
velocity = self.__oldPosDelta*(1.0/self.__oldDt)
# avoid divide by zero crash - grw
if self.__oldDt == 0:
velocity = 0
else:
velocity = self.__oldPosDelta*(1.0/self.__oldDt)
self.priorParent = Vec3(velocity)
if __debug__:
if self.wantDebugIndicator: