mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
*** empty log message ***
This commit is contained in:
parent
ad6b8e1c80
commit
a2437a514d
@ -122,18 +122,17 @@ class ControlManager:
|
|||||||
wallBitmask, floorBitmask, avatarRadius, floorOffset)
|
wallBitmask, floorBitmask, avatarRadius, floorOffset)
|
||||||
self.walkControls.setAirborneHeightFunc(self.avatar.getAirborneHeight)
|
self.walkControls.setAirborneHeightFunc(self.avatar.getAirborneHeight)
|
||||||
self.walkControls.disableAvatarControls()
|
self.walkControls.disableAvatarControls()
|
||||||
|
self.walkControls.setCollisionsActive(0)
|
||||||
|
|
||||||
self.swimControls.initializeCollisions(cTrav, self.avatar,
|
self.swimControls.initializeCollisions(cTrav, self.avatar,
|
||||||
wallBitmask, floorBitmask, avatarRadius, floorOffset)
|
wallBitmask, floorBitmask, avatarRadius, floorOffset)
|
||||||
self.swimControls.setAirborneHeightFunc(self.avatar.getAirborneHeight)
|
self.swimControls.setAirborneHeightFunc(self.avatar.getAirborneHeight)
|
||||||
self.swimControls.disableAvatarControls()
|
self.swimControls.disableAvatarControls()
|
||||||
|
self.swimControls.setCollisionsActive(0)
|
||||||
|
|
||||||
|
self.walkControls.setCollisionsActive(1)
|
||||||
self.walkControls.enableAvatarControls()
|
self.walkControls.enableAvatarControls()
|
||||||
|
|
||||||
if self.wantAvatarPhysicsIndicator:
|
|
||||||
indicator=loader.loadModelCopy('phase_5/models/props/dagger')
|
|
||||||
#self.walkControls.setAvatarPhysicsIndicator(indicator)
|
|
||||||
|
|
||||||
def deleteCollisions(self):
|
def deleteCollisions(self):
|
||||||
assert(self.debugPrint("deleteCollisions()"))
|
assert(self.debugPrint("deleteCollisions()"))
|
||||||
self.walkControls.deleteCollisions()
|
self.walkControls.deleteCollisions()
|
||||||
|
@ -248,16 +248,21 @@ class GravityWalker(DirectObject.DirectObject):
|
|||||||
tempCTrav.traverse(render)
|
tempCTrav.traverse(render)
|
||||||
|
|
||||||
def setMayJump(self, task):
|
def setMayJump(self, task):
|
||||||
|
"""
|
||||||
|
This function's use is internal to this class (maybe I'll add
|
||||||
|
the __ someday). Anyway, if you want to enable or disable
|
||||||
|
jumping in a general way see the ControlManager (don't use this).
|
||||||
|
"""
|
||||||
self.mayJump = 1
|
self.mayJump = 1
|
||||||
return Task.done
|
return Task.done
|
||||||
|
|
||||||
def startJumpDelay(self):
|
def startJumpDelay(self, delay):
|
||||||
assert(self.debugPrint("startJumpDelay()"))
|
assert(self.debugPrint("startJumpDelay(delay=%s)"%(delay,)))
|
||||||
if self.jumpDelayTask:
|
if self.jumpDelayTask:
|
||||||
self.jumpDelayTask.remove()
|
self.jumpDelayTask.remove()
|
||||||
self.mayJump = 0
|
self.mayJump = 0
|
||||||
self.jumpDelayTask=taskMgr.doMethodLater(
|
self.jumpDelayTask=taskMgr.doMethodLater(
|
||||||
0.5,
|
delay,
|
||||||
self.setMayJump,
|
self.setMayJump,
|
||||||
"jumpDelay-%s"%id(self))
|
"jumpDelay-%s"%id(self))
|
||||||
|
|
||||||
@ -295,14 +300,26 @@ class GravityWalker(DirectObject.DirectObject):
|
|||||||
onScreenDebug.add("airborneHeight", self.lifter.getAirborneHeight()) #*#
|
onScreenDebug.add("airborneHeight", self.lifter.getAirborneHeight()) #*#
|
||||||
onScreenDebug.add("falling", self.falling) #*#
|
onScreenDebug.add("falling", self.falling) #*#
|
||||||
onScreenDebug.add("isOnGround", self.lifter.isOnGround()) #*#
|
onScreenDebug.add("isOnGround", self.lifter.isOnGround()) #*#
|
||||||
|
|
||||||
|
onScreenDebug.add("gravity", self.lifter.getGravity()) #*#
|
||||||
|
onScreenDebug.add("jumpForce", self.avatarControlJumpForce) #*#
|
||||||
|
onScreenDebug.add("mayJump", self.mayJump) #*#
|
||||||
|
onScreenDebug.add("impact", self.lifter.getImpactVelocity()) #*#
|
||||||
|
|
||||||
onScreenDebug.add("velocity", self.lifter.getVelocity()) #*#
|
onScreenDebug.add("velocity", self.lifter.getVelocity()) #*#
|
||||||
onScreenDebug.add("jump", jump) #*#
|
onScreenDebug.add("jump", jump) #*#
|
||||||
if self.lifter.isOnGround():
|
if self.lifter.isOnGround():
|
||||||
if self.falling:
|
if self.falling:
|
||||||
self.falling = 0
|
self.falling = 0
|
||||||
#messenger.send("jumpHardLand")
|
impact = self.lifter.getImpactVelocity()
|
||||||
messenger.send("jumpLand")
|
if impact < -30.0:
|
||||||
self.startJumpDelay()
|
messenger.send("jumpHardLand")
|
||||||
|
self.startJumpDelay(0.1)
|
||||||
|
else:
|
||||||
|
messenger.send("jumpLand")
|
||||||
|
if impact < -5.0:
|
||||||
|
self.startJumpDelay(0.05)
|
||||||
|
# else, ignore the little potholes.
|
||||||
if jump and self.mayJump:
|
if jump and self.mayJump:
|
||||||
# ...the jump button is down and we're close
|
# ...the jump button is down and we're close
|
||||||
# enough to the ground to jump.
|
# enough to the ground to jump.
|
||||||
|
@ -723,6 +723,11 @@ class PhysicsWalker(DirectObject.DirectObject):
|
|||||||
|
|
||||||
|
|
||||||
if __debug__:
|
if __debug__:
|
||||||
|
def setupAvatarPhysicsIndicator(self):
|
||||||
|
if self.wantAvatarPhysicsIndicator:
|
||||||
|
indicator=loader.loadModelCopy('phase_5/models/props/dagger')
|
||||||
|
#self.walkControls.setAvatarPhysicsIndicator(indicator)
|
||||||
|
|
||||||
def debugPrint(self, message):
|
def debugPrint(self, message):
|
||||||
"""for debugging"""
|
"""for debugging"""
|
||||||
return self.notify.debug(
|
return self.notify.debug(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user