Browse Source

added stern sphere

Dave Schuyler 21 years ago
parent
commit
efcad6c65a
1 changed files with 16 additions and 0 deletions
  1. 16 0
      direct/src/controls/ShipPilot.py

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

@@ -170,6 +170,7 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
             self.cSphereNodePath = self.avatarNodePath.attachNewNode(cSphereNode)
             self.cSphereNodePath = self.avatarNodePath.attachNewNode(cSphereNode)
             self.cSphereBitMask = bitmask
             self.cSphereBitMask = bitmask
         else:
         else:
+            # Middle sphere:
             self.avatarRadius = avatarRadius
             self.avatarRadius = avatarRadius
             self.cSphere = CollisionSphere(0.0, -5.0, 0.0, avatarRadius)
             self.cSphere = CollisionSphere(0.0, -5.0, 0.0, avatarRadius)
             cSphereNode = CollisionNode('SP.cSphereNode')
             cSphereNode = CollisionNode('SP.cSphereNode')
@@ -188,6 +189,7 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
         self.pusher.addCollider(self.cSphereNodePath, self.avatarNodePath)
         self.pusher.addCollider(self.cSphereNodePath, self.avatarNodePath)
 
 
         if 1:
         if 1:
+            # Front sphere:
             self.cBowSphere = CollisionSphere(0.0, 20.0, 0.0, avatarRadius)
             self.cBowSphere = CollisionSphere(0.0, 20.0, 0.0, avatarRadius)
             cBowSphereNode = CollisionNode('SP.cBowSphereNode')
             cBowSphereNode = CollisionNode('SP.cBowSphereNode')
             cBowSphereNode.addSolid(self.cBowSphere)
             cBowSphereNode.addSolid(self.cBowSphere)
@@ -198,6 +200,18 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
             cBowSphereNode.setIntoCollideMask(BitMask32.allOff())
             cBowSphereNode.setIntoCollideMask(BitMask32.allOff())
 
 
             self.pusher.addCollider(self.cBowSphereNodePath, self.avatarNodePath)
             self.pusher.addCollider(self.cBowSphereNodePath, self.avatarNodePath)
+            
+            # Back sphere:
+            self.cSternSphere = CollisionSphere(0.0, -20.0, 0.0, avatarRadius)
+            cSternSphereNode = CollisionNode('SP.cSternSphereNode')
+            cSternSphereNode.addSolid(self.cSternSphere)
+            self.cSternSphereNodePath = self.avatarNodePath.attachNewNode(cSternSphereNode)
+            self.cSternSphereBitMask = bitmask
+
+            cSternSphereNode.setFromCollideMask(self.cSphereBitMask)
+            cSternSphereNode.setIntoCollideMask(BitMask32.allOff())
+
+            self.pusher.addCollider(self.cSternSphereNodePath, self.avatarNodePath)
 
 
     def takedownPhysics(self):
     def takedownPhysics(self):
         assert(self.debugPrint("takedownPhysics()"))
         assert(self.debugPrint("takedownPhysics()"))
@@ -423,6 +437,7 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
             if active:
             if active:
                 self.cTrav.addCollider(self.cSphereNodePath, self.pusher)
                 self.cTrav.addCollider(self.cSphereNodePath, self.pusher)
                 self.cTrav.addCollider(self.cBowSphereNodePath, self.pusher)
                 self.cTrav.addCollider(self.cBowSphereNodePath, self.pusher)
+                self.cTrav.addCollider(self.cSternSphereNodePath, self.pusher)
                 if self.useHeightRay:
                 if self.useHeightRay:
                     if self.useLifter:
                     if self.useLifter:
                         self.cTrav.addCollider(self.cRayNodePath, self.lifter)
                         self.cTrav.addCollider(self.cRayNodePath, self.lifter)
@@ -431,6 +446,7 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
             else:
             else:
                 self.cTrav.removeCollider(self.cSphereNodePath)
                 self.cTrav.removeCollider(self.cSphereNodePath)
                 self.cTrav.removeCollider(self.cBowSphereNodePath)
                 self.cTrav.removeCollider(self.cBowSphereNodePath)
+                self.cTrav.removeCollider(self.cSternSphereNodePath)
                 if self.useHeightRay:
                 if self.useHeightRay:
                     self.cTrav.removeCollider(self.cRayNodePath)
                     self.cTrav.removeCollider(self.cRayNodePath)
                 # Now that we have disabled collisions, make one more pass
                 # Now that we have disabled collisions, make one more pass