added if __debug__s

This commit is contained in:
Darren Ranalli 2003-11-25 08:11:05 +00:00
parent 3736a20226
commit 4d92e63fdd

View File

@ -175,6 +175,7 @@ class PhysicsWalker(DirectObject.DirectObject):
floorPoint = self.cRayQueue.getEntry(0).getFromIntersectionPoint() floorPoint = self.cRayQueue.getEntry(0).getFromIntersectionPoint()
height = -floorPoint.getZ() height = -floorPoint.getZ()
self.cRayQueue.clearEntries() self.cRayQueue.clearEntries()
if __debug__:
onScreenDebug.add("height", height) onScreenDebug.add("height", height)
return height return height
@ -387,6 +388,7 @@ class PhysicsWalker(DirectObject.DirectObject):
""" """
Check on the arrow keys and update the avatar. Check on the arrow keys and update the avatar.
""" """
if __debug__:
if self.wantAvatarPhysicsIndicator: if self.wantAvatarPhysicsIndicator:
onScreenDebug.append("localToon pos = %s\n"%(toonbase.localToon.getPos().pPrintValues(),)) onScreenDebug.append("localToon pos = %s\n"%(toonbase.localToon.getPos().pPrintValues(),))
onScreenDebug.append("localToon h = % 10.4f\n"%(toonbase.localToon.getH(),)) onScreenDebug.append("localToon h = % 10.4f\n"%(toonbase.localToon.getH(),))
@ -520,6 +522,7 @@ class PhysicsWalker(DirectObject.DirectObject):
airborneHeight=self.getAirborneHeight() airborneHeight=self.getAirborneHeight()
if airborneHeight > self.highMark: if airborneHeight > self.highMark:
self.highMark = airborneHeight self.highMark = airborneHeight
if __debug__:
onScreenDebug.add("highMark", "% 10.4f"%( onScreenDebug.add("highMark", "% 10.4f"%(
self.highMark,)) self.highMark,))
#if airborneHeight < 0.1: #contact!=Vec3.zero(): #if airborneHeight < 0.1: #contact!=Vec3.zero():
@ -560,6 +563,7 @@ class PhysicsWalker(DirectObject.DirectObject):
self.isAirborne = 1 # Avoid double impulse before fully airborne. self.isAirborne = 1 # Avoid double impulse before fully airborne.
else: else:
self.isAirborne = 0 self.isAirborne = 0
if __debug__:
onScreenDebug.add("isAirborne", "%d"%(self.isAirborne,)) onScreenDebug.add("isAirborne", "%d"%(self.isAirborne,))
else: else:
if contact!=Vec3.zero(): if contact!=Vec3.zero():
@ -596,6 +600,7 @@ class PhysicsWalker(DirectObject.DirectObject):
if not self.useHeightRay or self.isAirborne: if not self.useHeightRay or self.isAirborne:
# ...the airborne check is a hack to stop sliding. # ...the airborne check is a hack to stop sliding.
self.phys.doPhysics(dt) self.phys.doPhysics(dt)
if __debug__:
onScreenDebug.add("phys", "on") onScreenDebug.add("phys", "on")
else: else:
physObject.setVelocity(Vec3.zero()) physObject.setVelocity(Vec3.zero())
@ -603,6 +608,7 @@ class PhysicsWalker(DirectObject.DirectObject):
# moveToGround = Vec3(0.0, 0.0, -airborneHeight) # moveToGround = Vec3(0.0, 0.0, -airborneHeight)
#moveToGround = Vec3(0.0, 0.0, -airborneHeight) #moveToGround = Vec3(0.0, 0.0, -airborneHeight)
moveToGround = Vec3(0.0, 0.0, -self.determineHeight()) moveToGround = Vec3(0.0, 0.0, -self.determineHeight())
if __debug__:
onScreenDebug.add("phys", "off") onScreenDebug.add("phys", "off")
# Check to see if we're moving at all: # Check to see if we're moving at all:
if self.__speed or self.__slideSpeed or self.__rotationSpeed or moveToGround!=Vec3.zero(): if self.__speed or self.__slideSpeed or self.__rotationSpeed or moveToGround!=Vec3.zero():
@ -654,6 +660,7 @@ class PhysicsWalker(DirectObject.DirectObject):
assert(self.debugPrint("doDeltaPos()")) assert(self.debugPrint("doDeltaPos()"))
print "self.__oldDt", self.__oldDt, "self.__oldPosDelta", self.__oldPosDelta print "self.__oldDt", self.__oldDt, "self.__oldPosDelta", self.__oldPosDelta
if __debug__:
onScreenDebug.add("__oldDt", "% 10.4f"%self.__oldDt) onScreenDebug.add("__oldDt", "% 10.4f"%self.__oldDt)
onScreenDebug.add("self.__oldPosDelta", onScreenDebug.add("self.__oldPosDelta",
self.__oldPosDelta.pPrintValues()) self.__oldPosDelta.pPrintValues())
@ -662,6 +669,7 @@ class PhysicsWalker(DirectObject.DirectObject):
assert(self.debugPrint(" __oldPosDelta=%s"%(self.__oldPosDelta,))) assert(self.debugPrint(" __oldPosDelta=%s"%(self.__oldPosDelta,)))
assert(self.debugPrint(" velocity=%s"%(velocity,))) assert(self.debugPrint(" velocity=%s"%(velocity,)))
self.priorParent.setVector(Vec3(velocity)) self.priorParent.setVector(Vec3(velocity))
if __debug__:
if self.wantAvatarPhysicsIndicator: if self.wantAvatarPhysicsIndicator:
onScreenDebug.add("velocity", velocity.pPrintValues()) onScreenDebug.add("velocity", velocity.pPrintValues())