mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -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
|
import DirectObject
|
||||||
|
|
||||||
class NonPhysicsWalker(DirectObject.DirectObject):
|
class NonPhysicsWalker(DirectObject.DirectObject):
|
||||||
|
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory("NonPhysicsWalker")
|
notify = DirectNotifyGlobal.directNotify.newCategory("NonPhysicsWalker")
|
||||||
|
wantDebugIndicator = base.config.GetBool('want-avatar-physics-indicator', 0)
|
||||||
|
|
||||||
# Ghost mode overrides this:
|
# Ghost mode overrides this:
|
||||||
slideName = "slide-is-disabled"
|
slideName = "slide-is-disabled"
|
||||||
@ -162,6 +162,12 @@ class NonPhysicsWalker(DirectObject.DirectObject):
|
|||||||
tempCTrav.addCollider(self.cRayNodePath, self.lifter)
|
tempCTrav.addCollider(self.cRayNodePath, self.lifter)
|
||||||
tempCTrav.traverse(render)
|
tempCTrav.traverse(render)
|
||||||
|
|
||||||
|
def displayDebugInfo(self):
|
||||||
|
"""
|
||||||
|
For debug use.
|
||||||
|
"""
|
||||||
|
onScreenDebug.add("controls", "NonPhysicsWalker")
|
||||||
|
|
||||||
def handleAvatarControls(self, task):
|
def handleAvatarControls(self, task):
|
||||||
"""
|
"""
|
||||||
Check on the arrow keys and update the avatar.
|
Check on the arrow keys and update the avatar.
|
||||||
@ -188,6 +194,8 @@ class NonPhysicsWalker(DirectObject.DirectObject):
|
|||||||
(turnLeft and self.avatarControlRotateSpeed) or
|
(turnLeft and self.avatarControlRotateSpeed) or
|
||||||
(turnRight and -self.avatarControlRotateSpeed))
|
(turnRight and -self.avatarControlRotateSpeed))
|
||||||
|
|
||||||
|
if self.wantDebugIndicator:
|
||||||
|
self.displayDebugInfo()
|
||||||
# How far did we move based on the amount of time elapsed?
|
# How far did we move based on the amount of time elapsed?
|
||||||
dt=ClockObject.getGlobalClock().getDt()
|
dt=ClockObject.getGlobalClock().getDt()
|
||||||
# Check to see if we're moving at all:
|
# Check to see if we're moving at all:
|
||||||
@ -230,7 +238,7 @@ class NonPhysicsWalker(DirectObject.DirectObject):
|
|||||||
assert(self.debugPrint("enableAvatarControls"))
|
assert(self.debugPrint("enableAvatarControls"))
|
||||||
assert self.collisionsActive
|
assert self.collisionsActive
|
||||||
|
|
||||||
taskName = "AvatarControls%s"%(id(self),)
|
taskName = "AvatarControls-%s"%(id(self),)
|
||||||
# remove any old
|
# remove any old
|
||||||
taskMgr.remove(taskName)
|
taskMgr.remove(taskName)
|
||||||
# spawn the new task
|
# spawn the new task
|
||||||
@ -241,7 +249,7 @@ class NonPhysicsWalker(DirectObject.DirectObject):
|
|||||||
Ignore the arrow keys, etc.
|
Ignore the arrow keys, etc.
|
||||||
"""
|
"""
|
||||||
assert(self.debugPrint("disableAvatarControls"))
|
assert(self.debugPrint("disableAvatarControls"))
|
||||||
taskName = "AvatarControls%s"%(id(self),)
|
taskName = "AvatarControls-%s"%(id(self),)
|
||||||
taskMgr.remove(taskName)
|
taskMgr.remove(taskName)
|
||||||
|
|
||||||
if __debug__:
|
if __debug__:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user