Переглянути джерело

moved jump landing force.

Dave Schuyler 22 роки тому
батько
коміт
72a9a6a007

+ 4 - 5
direct/src/actor/Actor.py

@@ -511,13 +511,10 @@ class Actor(PandaObject, NodePath):
         return animControl.getNumFrames() / animControl.getFrameRate()
 
     def getNumFrames(self, animName=None, partName=None):
-        """ getNumFrames(animName, partName)
-        """
         lodName = self.__animControlDict.keys()[0]
         controls = self.getAnimControls(animName, partName)
         if len(controls) == 0:
             return None
-
         return controls[0].getNumFrames()
         
     def getCurrentAnim(self, partName=None):
@@ -940,7 +937,8 @@ class Actor(PandaObject, NodePath):
             control.pose(frame)
 
     def enableBlend(self, blendType = PartBundle.BTNormalizedLinear, partName = None):
-        """Enables blending of multiple animations simultaneously.
+        """
+        Enables blending of multiple animations simultaneously.
         After this is called, you may call play(), loop(), or pose()
         on multiple animations and have all of them contribute to the
         final pose each frame.
@@ -970,7 +968,8 @@ class Actor(PandaObject, NodePath):
 
     def setControlEffect(self, animName, effect,
                          partName = None, lodName = None):
-        """ Sets the amount by which the named animation contributes to
+        """
+        Sets the amount by which the named animation contributes to
         the overall pose.  This controls blending of multiple
         animations; it only makes sense to call this after a previous
         call to enableBlend().

+ 15 - 1
direct/src/showbase/NonPhysicsWalker.py

@@ -1,4 +1,18 @@
-"""NonPhysicsWalker.py is for avatars."""
+"""
+NonPhysicsWalker.py is for avatars.
+
+A walker control such as this one provides:
+    - creation of the collision nodes
+    - handling the keyboard and mouse input for avatar movement
+    - moving the avatar
+
+it does not:
+    - play sounds
+    - play animations
+
+although it does send messeges that allow a listener to play sounds or
+animations based on walker events.
+"""
 
 from ShowBaseGlobal import *
 

+ 19 - 4
direct/src/showbase/PhysicsWalker.py

@@ -1,4 +1,18 @@
-"""PhysicsWalker.py is for avatars."""
+"""
+PhysicsWalker.py is for avatars.
+
+A walker control such as this one provides:
+    - creation of the collision nodes
+    - handling the keyboard and mouse input for avatar movement
+    - moving the avatar
+
+it does not:
+    - play sounds
+    - play animations
+
+although it does send messeges that allow a listener to play sounds or
+animations based on walker events.
+"""
 
 from ShowBaseGlobal import *
 
@@ -13,12 +27,14 @@ class PhysicsWalker(DirectObject.DirectObject):
     wantAvatarPhysicsIndicator = base.config.GetBool('want-avatar-physics-indicator', 1)
 
     # special methods
-    def __init__(self, gravity = -32.1740, standableGround=0.707):
+    def __init__(self, gravity = -32.1740, standableGround=0.707,
+            hardLandingForce=16.0):
         assert(self.debugPrint("PhysicsWalker(gravity=%s, standableGround=%s)"%(
                 gravity, standableGround)))
         DirectObject.DirectObject.__init__(self)
         self.__gravity=gravity
         self.__standableGround=standableGround
+        self.__hardLandingForce=hardLandingForce
 
         self.physVelocityIndicator=None
         self.__old_contact=None
@@ -236,8 +252,7 @@ class PhysicsWalker(DirectObject.DirectObject):
                 # ...avatar is on standable ground.
                 if self.__old_contact==Vec3.zero():
                     jumpTime = 0.0
-                    print "contactLength", contactLength
-                    if contactLength>14.0:
+                    if contactLength>self.__hardLandingForce:
                         # ...avatar was airborne.
                         messenger.send("jumpHardLand")
                     else: