make floorSphere configurable

This commit is contained in:
David Rose 2004-02-06 19:19:44 +00:00
parent d0e244d6b1
commit e5dc497667
1 changed files with 12 additions and 6 deletions

View File

@ -26,6 +26,7 @@ class GravityWalker(DirectObject.DirectObject):
notify = DirectNotifyGlobal.directNotify.newCategory("GravityWalker")
wantDebugIndicator = base.config.GetBool('want-avatar-physics-indicator', 0)
wantFloorSphere = base.config.GetBool('want-floor-sphere', 0)
# special methods
def __init__(self, gravity = -32.1740, standableGround=0.707,
@ -282,7 +283,8 @@ class GravityWalker(DirectObject.DirectObject):
self.setupRay(floorBitmask, self.floorOffset)
self.setupWallSphere(wallBitmask, avatarRadius)
self.setupEventSphere(wallBitmask, avatarRadius)
# self.setupFloorSphere(floorBitmask, avatarRadius)
if self.wantFloorSphere:
self.setupFloorSphere(floorBitmask, avatarRadius)
self.setCollisionsActive(1)
@ -305,8 +307,9 @@ class GravityWalker(DirectObject.DirectObject):
self.cWallSphereNodePath.removeNode()
del self.cWallSphereNodePath
# self.cFloorSphereNodePath.removeNode()
# del self.cFloorSphereNodePath
if self.wantFloorSphere:
self.cFloorSphereNodePath.removeNode()
del self.cFloorSphereNodePath
del self.pusher
# del self.pusherFloor
@ -324,12 +327,14 @@ class GravityWalker(DirectObject.DirectObject):
self.oneTimeCollide()
if active:
self.cTrav.addCollider(self.cWallSphereNodePath, self.pusher)
# self.cTrav.addCollider(self.cFloorSphereNodePath, self.pusherFloor)
if self.wantFloorSphere:
self.cTrav.addCollider(self.cFloorSphereNodePath, self.pusherFloor)
self.cTrav.addCollider(self.cEventSphereNodePath, self.event)
self.cTrav.addCollider(self.cRayNodePath, self.lifter)
else:
self.cTrav.removeCollider(self.cWallSphereNodePath)
# self.cTrav.removeCollider(self.cFloorSphereNodePath)
if self.wantFloorSphere:
self.cTrav.removeCollider(self.cFloorSphereNodePath)
self.cTrav.removeCollider(self.cEventSphereNodePath)
self.cTrav.removeCollider(self.cRayNodePath)
@ -371,7 +376,8 @@ class GravityWalker(DirectObject.DirectObject):
assert(self.debugPrint("oneTimeCollide()"))
tempCTrav = CollisionTraverser("oneTimeCollide")
tempCTrav.addCollider(self.cWallSphereNodePath, self.pusher)
# tempCTrav.addCollider(self.cFloorSphereNodePath, self.event)
if self.wantFloorSphere:
tempCTrav.addCollider(self.cFloorSphereNodePath, self.event)
tempCTrav.addCollider(self.cRayNodePath, self.lifter)
tempCTrav.traverse(render)