From c876c52dbd1c9c15ce852828fd0f32a967447917 Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Fri, 23 Apr 2004 03:49:46 +0000 Subject: [PATCH] added debug info; changed task name --- direct/src/showbase/NonPhysicsWalker.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/direct/src/showbase/NonPhysicsWalker.py b/direct/src/showbase/NonPhysicsWalker.py index 5a011ccc5e..625fd62d68 100755 --- a/direct/src/showbase/NonPhysicsWalker.py +++ b/direct/src/showbase/NonPhysicsWalker.py @@ -20,8 +20,8 @@ import DirectNotifyGlobal import DirectObject class NonPhysicsWalker(DirectObject.DirectObject): - notify = DirectNotifyGlobal.directNotify.newCategory("NonPhysicsWalker") + wantDebugIndicator = base.config.GetBool('want-avatar-physics-indicator', 0) # Ghost mode overrides this: slideName = "slide-is-disabled" @@ -46,7 +46,7 @@ class NonPhysicsWalker(DirectObject.DirectObject): #assert(self.debugPrint("getSpeeds()")) return (self.speed, self.rotationSpeed) - def initializeCollisions(self, collisionTraverser, avatarNodePath, + def initializeCollisions(self, collisionTraverser, avatarNodePath, wallCollideMask, floorCollideMask, avatarRadius = 1.4, floorOffset = 1.0, reach = 1.0): """ @@ -162,6 +162,12 @@ class NonPhysicsWalker(DirectObject.DirectObject): tempCTrav.addCollider(self.cRayNodePath, self.lifter) tempCTrav.traverse(render) + def displayDebugInfo(self): + """ + For debug use. + """ + onScreenDebug.add("controls", "NonPhysicsWalker") + def handleAvatarControls(self, task): """ Check on the arrow keys and update the avatar. @@ -187,7 +193,9 @@ class NonPhysicsWalker(DirectObject.DirectObject): self.rotationSpeed=not slide and ( (turnLeft and self.avatarControlRotateSpeed) or (turnRight and -self.avatarControlRotateSpeed)) - + + if self.wantDebugIndicator: + self.displayDebugInfo() # How far did we move based on the amount of time elapsed? dt=ClockObject.getGlobalClock().getDt() # Check to see if we're moving at all: @@ -230,7 +238,7 @@ class NonPhysicsWalker(DirectObject.DirectObject): assert(self.debugPrint("enableAvatarControls")) assert self.collisionsActive - taskName = "AvatarControls%s"%(id(self),) + taskName = "AvatarControls-%s"%(id(self),) # remove any old taskMgr.remove(taskName) # spawn the new task @@ -241,7 +249,7 @@ class NonPhysicsWalker(DirectObject.DirectObject): Ignore the arrow keys, etc. """ assert(self.debugPrint("disableAvatarControls")) - taskName = "AvatarControls%s"%(id(self),) + taskName = "AvatarControls-%s"%(id(self),) taskMgr.remove(taskName) if __debug__: