浏览代码

add pie toss mode

David Rose 22 年之前
父节点
当前提交
98d94188a8
共有 2 个文件被更改,包括 17 次插入0 次删除
  1. 8 0
      direct/src/showbase/NonPhysicsWalker.py
  2. 9 0
      direct/src/showbase/PhysicsWalker.py

+ 8 - 0
direct/src/showbase/NonPhysicsWalker.py

@@ -157,6 +157,7 @@ class NonPhysicsWalker(DirectObject.DirectObject):
         turnRight = inputState.isSet("turnRight")
         slide = inputState.isSet("slide")
         #jump = inputState.isSet("jump")
+        pie = inputState.isSet("pie")
         # Determine what the speeds are based on the buttons:
         self.speed=(forward and self.avatarControlForwardSpeed or 
                     reverse and -self.avatarControlReverseSpeed)
@@ -167,6 +168,13 @@ class NonPhysicsWalker(DirectObject.DirectObject):
         self.rotationSpeed=not slide and (
                 (turnLeft and self.avatarControlRotateSpeed) or
                 (turnRight and -self.avatarControlRotateSpeed))
+
+        # No moving allowed while throwing a pie.
+        if pie:
+            self.speed = 0
+            self.slideSpeed = 0
+            self.rotationSpeed = 0
+            
         # How far did we move based on the amount of time elapsed?
         dt=min(ClockObject.getGlobalClock().getDt(), 0.1)
         # Check to see if we're moving at all:

+ 9 - 0
direct/src/showbase/PhysicsWalker.py

@@ -406,6 +406,7 @@ class PhysicsWalker(DirectObject.DirectObject):
         turnRight = inputState.isSet("turnRight")
         slide = inputState.isSet("slide")
         jump = inputState.isSet("jump")
+        pie = inputState.isSet("pie")
         # Determine what the speeds are based on the buttons:
         self.__speed=(forward and self.avatarControlForwardSpeed or 
                 reverse and -self.avatarControlReverseSpeed)
@@ -415,6 +416,14 @@ class PhysicsWalker(DirectObject.DirectObject):
         self.__rotationSpeed=not slide and (
                 (turnLeft and self.avatarControlRotateSpeed) or
                 (turnRight and -self.avatarControlRotateSpeed))
+
+        # No moving allowed while throwing a pie.
+        if pie:
+            self.__speed = 0
+            self.__slideSpeed = 0
+            self.__rotationSpeed = 0
+            jump = 0
+
         # How far did we move based on the amount of time elapsed?
         dt=min(ClockObject.getGlobalClock().getDt(), 0.1)