Browse Source

add getVelocity

Samir Naik 21 years ago
parent
commit
db891ff937

+ 3 - 0
direct/src/controls/GravityWalker.py

@@ -583,6 +583,9 @@ class GravityWalker(DirectObject.DirectObject):
         self.lifter.setVelocity(0.0)
         self.priorParent=Vec3.zero()
 
+    def getVelocity(self):
+        return self.vel
+
     def enableAvatarControls(self):
         """
         Activate the arrow keys, etc.

+ 4 - 0
direct/src/controls/PhysicsWalker.py

@@ -722,6 +722,10 @@ class PhysicsWalker(DirectObject.DirectObject):
             onScreenDebug.add("highMark", "% 10.4f"%(self.highMark,))
             onScreenDebug.add("contact", contact.pPrintValues())
 
+    def getVelocity(self):
+        physObject=self.actorNode.getPhysicsObject()
+        return physObject.getVelocity()
+
     def enableAvatarControls(self):
         """
         Activate the arrow keys, etc.

+ 3 - 0
direct/src/controls/ShipPilot.py

@@ -912,6 +912,9 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
             onScreenDebug.add("highMark", "% 10.4f"%(self.highMark,))
             onScreenDebug.add("contact", contact.pPrintValues())
 
+    def getVelocity(self):
+        return self.__vel
+
     def enableAvatarControls(self):
         """
         Activate the arrow keys, etc.