From e5dc4976677650a0430c4abd7a138cbafb493189 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 6 Feb 2004 19:19:44 +0000 Subject: [PATCH] make floorSphere configurable --- direct/src/showbase/GravityWalker.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/direct/src/showbase/GravityWalker.py b/direct/src/showbase/GravityWalker.py index bebcaa42d9..fd1a9d969c 100755 --- a/direct/src/showbase/GravityWalker.py +++ b/direct/src/showbase/GravityWalker.py @@ -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)