mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
added debug info; changed task name
This commit is contained in:
parent
41268cd9a8
commit
c876c52dbd
@ -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"
|
||||
@ -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.
|
||||
@ -188,6 +194,8 @@ class NonPhysicsWalker(DirectObject.DirectObject):
|
||||
(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__:
|
||||
|
Loading…
x
Reference in New Issue
Block a user