Change to the ship collision spheres to prevent penetration with other ships. I made the spheres larger and further apart to better represent the ship.

This commit is contained in:
Justin Butler 2005-12-13 00:05:25 +00:00
parent d4f5097fbd
commit 7a9d0c11ad
1 changed files with 6 additions and 3 deletions

View File

@ -194,7 +194,7 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
if 1:
# Front sphere:
self.cBowSphere = CollisionSphere(0.0, 35.0, -5.0, avatarRadius)
self.cBowSphere = CollisionSphere(0.0, self.frontSphereOffset, -5.0, avatarRadius)
cBowSphereNode = CollisionNode('SP.cBowSphereNode')
cBowSphereNode.addSolid(self.cBowSphere)
self.cBowSphereNodePath = self.avatarNodePath.attachNewNode(cBowSphereNode)
@ -207,7 +207,7 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
self.pusher.addCollider(self.cBowSphereNodePath, self.avatarNodePath)
# Back sphere:
self.cSternSphere = CollisionSphere(0.0, -20.0, -5.0, avatarRadius)
self.cSternSphere = CollisionSphere(0.0, self.backSphereOffset, -5.0, avatarRadius)
cSternSphereNode = CollisionNode('SP.cSternSphereNode')
cSternSphereNode.addSolid(self.cSternSphere)
self.cSternSphereNodePath = self.avatarNodePath.attachNewNode(cSternSphereNode)
@ -354,7 +354,8 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
self.floorBitmask = bitMask
def initializeCollisions(self, collisionTraverser,
avatarRadius = 1.4, floorOffset = 1.0, reach = 1.0):
avatarRadius = 1.4, floorOffset = 1.0, reach = 1.0,
frontSphereOffset = 35.0, backSphereOffset = -80.0):
"""
Set up the avatar collisions
"""
@ -363,6 +364,8 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
self.avatarRadius = avatarRadius
self.floorOffset = floorOffset
self.reach = reach
self.frontSphereOffset = frontSphereOffset
self.backSphereOffset = backSphereOffset
def deleteCollisions(self):
assert(self.debugPrint("deleteCollisions()"))