|
@@ -358,7 +358,7 @@ class PhysicsWalker(DirectObject.DirectObject):
|
|
|
self.avatarNodePath,
|
|
self.avatarNodePath,
|
|
|
self.avatarNodePath.getPosDelta(render)).pPrintValues())
|
|
self.avatarNodePath.getPosDelta(render)).pPrintValues())
|
|
|
|
|
|
|
|
- if 1:
|
|
|
|
|
|
|
+ if 0:
|
|
|
onScreenDebug.add("gravity",
|
|
onScreenDebug.add("gravity",
|
|
|
self.gravity.getLocalVector().pPrintValues())
|
|
self.gravity.getLocalVector().pPrintValues())
|
|
|
onScreenDebug.add("priorParent",
|
|
onScreenDebug.add("priorParent",
|
|
@@ -407,14 +407,14 @@ class PhysicsWalker(DirectObject.DirectObject):
|
|
|
self.highMark,))
|
|
self.highMark,))
|
|
|
#if airborneHeight < 0.1: #contact!=Vec3.zero():
|
|
#if airborneHeight < 0.1: #contact!=Vec3.zero():
|
|
|
if 1:
|
|
if 1:
|
|
|
- onScreenDebug.add("isAirborne", "%d"%(
|
|
|
|
|
- self.isAirborne,))
|
|
|
|
|
if airborneHeight > 0.7:
|
|
if airborneHeight > 0.7:
|
|
|
# ...the avatar is airborne (maybe a lot or a tiny amount).
|
|
# ...the avatar is airborne (maybe a lot or a tiny amount).
|
|
|
self.isAirborne = 1
|
|
self.isAirborne = 1
|
|
|
else:
|
|
else:
|
|
|
- # ...the avatar has touched something (but might not be on the ground).
|
|
|
|
|
|
|
+ # ...the avatar is very close to the ground (close enough to be
|
|
|
|
|
+ # considered on the ground).
|
|
|
if self.isAirborne:
|
|
if self.isAirborne:
|
|
|
|
|
+ # ...the avatar has landed.
|
|
|
contactLength = contact.length()
|
|
contactLength = contact.length()
|
|
|
if contactLength>self.__hardLandingForce:
|
|
if contactLength>self.__hardLandingForce:
|
|
|
#print "jumpHardLand"
|
|
#print "jumpHardLand"
|
|
@@ -422,8 +422,8 @@ class PhysicsWalker(DirectObject.DirectObject):
|
|
|
else:
|
|
else:
|
|
|
#print "jumpLand"
|
|
#print "jumpLand"
|
|
|
messenger.send("jumpLand")
|
|
messenger.send("jumpLand")
|
|
|
- self.isAirborne = 0
|
|
|
|
|
- if self.__jumpButton:
|
|
|
|
|
|
|
+ self.isAirborne = 0
|
|
|
|
|
+ elif self.__jumpButton:
|
|
|
#print "jump"
|
|
#print "jump"
|
|
|
self.__jumpButton=0
|
|
self.__jumpButton=0
|
|
|
messenger.send("jumpStart")
|
|
messenger.send("jumpStart")
|
|
@@ -432,9 +432,11 @@ class PhysicsWalker(DirectObject.DirectObject):
|
|
|
jump.normalize()
|
|
jump.normalize()
|
|
|
jump*=self.avatarControlJumpForce
|
|
jump*=self.avatarControlJumpForce
|
|
|
physObject.addImpulse(Vec3(jump))
|
|
physObject.addImpulse(Vec3(jump))
|
|
|
-
|
|
|
|
|
|
|
+ self.isAirborne = 1 # Avoid double impulse before fully airborne.
|
|
|
|
|
+ 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).
|
|
|
contactLength = contact.length()
|
|
contactLength = contact.length()
|
|
|
contact.normalize()
|
|
contact.normalize()
|
|
|
angle=contact.dot(Vec3.up())
|
|
angle=contact.dot(Vec3.up())
|