added bow sphere

This commit is contained in:
Dave Schuyler 2004-09-09 02:35:47 +00:00
parent dc02cb5d11
commit 3cf0b32484

View File

@ -162,8 +162,16 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
Set up the collision sphere
"""
# This is a sphere on the ground to detect barrier collisions
if 0:
self.avatarRadius = avatarRadius
self.cSphere = CollisionSphere(0.0, 0.0, 0.0, avatarRadius)
self.cSphere = CollisionTube(Point3(0.0, 0.0, 0.0), Point3(0.0, 40.0, 0.0), avatarRadius)
cSphereNode = CollisionNode('SP.cSphereNode')
cSphereNode.addSolid(self.cSphere)
self.cSphereNodePath = self.avatarNodePath.attachNewNode(cSphereNode)
self.cSphereBitMask = bitmask
else:
self.avatarRadius = avatarRadius
self.cSphere = CollisionSphere(0.0, -5.0, 0.0, avatarRadius)
cSphereNode = CollisionNode('SP.cSphereNode')
cSphereNode.addSolid(self.cSphere)
self.cSphereNodePath = self.avatarNodePath.attachNewNode(cSphereNode)
@ -179,6 +187,18 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
self.pusher.addCollider(self.cSphereNodePath, self.avatarNodePath)
if 1:
self.cBowSphere = CollisionSphere(0.0, 20.0, 0.0, avatarRadius)
cBowSphereNode = CollisionNode('SP.cBowSphereNode')
cBowSphereNode.addSolid(self.cBowSphere)
self.cBowSphereNodePath = self.avatarNodePath.attachNewNode(cBowSphereNode)
self.cBowSphereBitMask = bitmask
cBowSphereNode.setFromCollideMask(self.cSphereBitMask)
cBowSphereNode.setIntoCollideMask(BitMask32.allOff())
self.pusher.addCollider(self.cBowSphereNodePath, self.avatarNodePath)
def takedownPhysics(self):
assert(self.debugPrint("takedownPhysics()"))
if hasattr(self, "phys"):
@ -391,6 +411,7 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
self.collisionsActive = active
if active:
self.cTrav.addCollider(self.cSphereNodePath, self.pusher)
self.cTrav.addCollider(self.cBowSphereNodePath, self.pusher)
if self.useHeightRay:
if self.useLifter:
self.cTrav.addCollider(self.cRayNodePath, self.lifter)
@ -398,6 +419,7 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
self.cTrav.addCollider(self.cRayNodePath, self.cRayQueue)
else:
self.cTrav.removeCollider(self.cSphereNodePath)
self.cTrav.removeCollider(self.cBowSphereNodePath)
if self.useHeightRay:
self.cTrav.removeCollider(self.cRayNodePath)
# Now that we have disabled collisions, make one more pass