mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
added if __debug__s
This commit is contained in:
parent
3736a20226
commit
4d92e63fdd
@ -175,7 +175,8 @@ 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()
|
||||||
onScreenDebug.add("height", height)
|
if __debug__:
|
||||||
|
onScreenDebug.add("height", height)
|
||||||
return height
|
return height
|
||||||
|
|
||||||
def setupSphere(self, bitmask, avatarRadius):
|
def setupSphere(self, bitmask, avatarRadius):
|
||||||
@ -387,10 +388,11 @@ class PhysicsWalker(DirectObject.DirectObject):
|
|||||||
"""
|
"""
|
||||||
Check on the arrow keys and update the avatar.
|
Check on the arrow keys and update the avatar.
|
||||||
"""
|
"""
|
||||||
if self.wantAvatarPhysicsIndicator:
|
if __debug__:
|
||||||
onScreenDebug.append("localToon pos = %s\n"%(toonbase.localToon.getPos().pPrintValues(),))
|
if self.wantAvatarPhysicsIndicator:
|
||||||
onScreenDebug.append("localToon h = % 10.4f\n"%(toonbase.localToon.getH(),))
|
onScreenDebug.append("localToon pos = %s\n"%(toonbase.localToon.getPos().pPrintValues(),))
|
||||||
onScreenDebug.append("localToon anim = %s\n"%(toonbase.localToon.animFSM.getCurrentState().getName(),))
|
onScreenDebug.append("localToon h = % 10.4f\n"%(toonbase.localToon.getH(),))
|
||||||
|
onScreenDebug.append("localToon anim = %s\n"%(toonbase.localToon.animFSM.getCurrentState().getName(),))
|
||||||
#assert(self.debugPrint("handleAvatarControls(task=%s)"%(task,)))
|
#assert(self.debugPrint("handleAvatarControls(task=%s)"%(task,)))
|
||||||
physObject=self.actorNode.getPhysicsObject()
|
physObject=self.actorNode.getPhysicsObject()
|
||||||
#rotAvatarToPhys=Mat3.rotateMatNormaxis(-self.avatarNodePath.getH(), Vec3.up())
|
#rotAvatarToPhys=Mat3.rotateMatNormaxis(-self.avatarNodePath.getH(), Vec3.up())
|
||||||
@ -520,8 +522,9 @@ class PhysicsWalker(DirectObject.DirectObject):
|
|||||||
airborneHeight=self.getAirborneHeight()
|
airborneHeight=self.getAirborneHeight()
|
||||||
if airborneHeight > self.highMark:
|
if airborneHeight > self.highMark:
|
||||||
self.highMark = airborneHeight
|
self.highMark = airborneHeight
|
||||||
onScreenDebug.add("highMark", "% 10.4f"%(
|
if __debug__:
|
||||||
self.highMark,))
|
onScreenDebug.add("highMark", "% 10.4f"%(
|
||||||
|
self.highMark,))
|
||||||
#if airborneHeight < 0.1: #contact!=Vec3.zero():
|
#if airborneHeight < 0.1: #contact!=Vec3.zero():
|
||||||
if 1:
|
if 1:
|
||||||
if (airborneHeight > self.avatarRadius*0.5
|
if (airborneHeight > self.avatarRadius*0.5
|
||||||
@ -560,7 +563,8 @@ 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
|
||||||
onScreenDebug.add("isAirborne", "%d"%(self.isAirborne,))
|
if __debug__:
|
||||||
|
onScreenDebug.add("isAirborne", "%d"%(self.isAirborne,))
|
||||||
else:
|
else:
|
||||||
if contact!=Vec3.zero():
|
if contact!=Vec3.zero():
|
||||||
# ...the avatar has touched something (but might not be on the ground).
|
# ...the avatar has touched something (but might not be on the ground).
|
||||||
@ -596,14 +600,16 @@ 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)
|
||||||
onScreenDebug.add("phys", "on")
|
if __debug__:
|
||||||
|
onScreenDebug.add("phys", "on")
|
||||||
else:
|
else:
|
||||||
physObject.setVelocity(Vec3.zero())
|
physObject.setVelocity(Vec3.zero())
|
||||||
#if airborneHeight>0.001 and contact==Vec3.zero():
|
#if airborneHeight>0.001 and contact==Vec3.zero():
|
||||||
# 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())
|
||||||
onScreenDebug.add("phys", "off")
|
if __debug__:
|
||||||
|
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():
|
||||||
distance = dt * self.__speed
|
distance = dt * self.__speed
|
||||||
@ -654,16 +660,18 @@ 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
|
||||||
onScreenDebug.add("__oldDt", "% 10.4f"%self.__oldDt)
|
if __debug__:
|
||||||
onScreenDebug.add("self.__oldPosDelta",
|
onScreenDebug.add("__oldDt", "% 10.4f"%self.__oldDt)
|
||||||
self.__oldPosDelta.pPrintValues())
|
onScreenDebug.add("self.__oldPosDelta",
|
||||||
|
self.__oldPosDelta.pPrintValues())
|
||||||
|
|
||||||
velocity = self.__oldPosDelta*(1/self.__oldDt)
|
velocity = self.__oldPosDelta*(1/self.__oldDt)
|
||||||
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 self.wantAvatarPhysicsIndicator:
|
if __debug__:
|
||||||
onScreenDebug.add("velocity", velocity.pPrintValues())
|
if self.wantAvatarPhysicsIndicator:
|
||||||
|
onScreenDebug.add("velocity", velocity.pPrintValues())
|
||||||
|
|
||||||
def resetPhys(self):
|
def resetPhys(self):
|
||||||
assert(self.debugPrint("resetPhys()"))
|
assert(self.debugPrint("resetPhys()"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user