Răsfoiți Sursa

fixed swimming

Dave Schuyler 22 ani în urmă
părinte
comite
bd093075a0

+ 1 - 3
direct/src/showbase/ControlManager.py

@@ -27,9 +27,7 @@ class ControlManager:
         
         
         self.enableJumpCounter = 1
         self.enableJumpCounter = 1
         
         
-        self.swimControls=GravityWalker.GravityWalker(
-                    gravity = -32.1740 * 2.0)
-        #self.swimControls=NonPhysicsWalker.NonPhysicsWalker()
+        self.swimControls=NonPhysicsWalker.NonPhysicsWalker()
         self.ghostControls=GhostWalker.GhostWalker()
         self.ghostControls=GhostWalker.GhostWalker()
         if __debug__:
         if __debug__:
             self.devControls=DevWalker.DevWalker()
             self.devControls=DevWalker.DevWalker()

+ 1 - 1
direct/src/showbase/GravityWalker.py

@@ -158,7 +158,7 @@ class GravityWalker(DirectObject.DirectObject):
         """
         """
         # This is a sphere on the ground to detect barrier collisions
         # This is a sphere on the ground to detect barrier collisions
         self.avatarRadius = avatarRadius
         self.avatarRadius = avatarRadius
-        self.cSphere = CollisionSphere(0.0, 0.0, avatarRadius+0.5, avatarRadius)
+        self.cSphere = CollisionSphere(0.0, 0.0, avatarRadius, avatarRadius)
         cSphereNode = CollisionNode('GW.cWallSphereNode')
         cSphereNode = CollisionNode('GW.cWallSphereNode')
         cSphereNode.addSolid(self.cSphere)
         cSphereNode.addSolid(self.cSphere)
         cSphereNodePath = self.avatarNodePath.attachNewNode(cSphereNode)
         cSphereNodePath = self.avatarNodePath.attachNewNode(cSphereNode)

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

@@ -154,7 +154,7 @@ class NonPhysicsWalker(DirectObject.DirectObject):
         reverse = inputState.isSet("reverse")
         reverse = inputState.isSet("reverse")
         turnLeft = inputState.isSet("turnLeft")
         turnLeft = inputState.isSet("turnLeft")
         turnRight = inputState.isSet("turnRight")
         turnRight = inputState.isSet("turnRight")
-        slide = inputState.isSet(self.slideName)
+        slide = inputState.isSet(self.slideName) or 0
         #jump = inputState.isSet("jump")
         #jump = inputState.isSet("jump")
         # Determine what the speeds are based on the buttons:
         # Determine what the speeds are based on the buttons:
         self.speed=(forward and self.avatarControlForwardSpeed or 
         self.speed=(forward and self.avatarControlForwardSpeed or 
@@ -196,6 +196,10 @@ class NonPhysicsWalker(DirectObject.DirectObject):
             self.vel.set(0.0, 0.0, 0.0)
             self.vel.set(0.0, 0.0, 0.0)
         return Task.cont
         return Task.cont
     
     
+    def doDeltaPos(self):
+        assert(self.debugPrint("doDeltaPos()"))
+        pass
+    
     def reset(self):
     def reset(self):
         assert(self.debugPrint("reset()"))
         assert(self.debugPrint("reset()"))
         pass
         pass