소스 검색

comment out unneeded events, adjust comments, minor cleanup

David Rose 22 년 전
부모
커밋
fa3df4a74c
1개의 변경된 파일20개의 추가작업 그리고 16개의 파일을 삭제
  1. 20 16
      direct/src/showbase/GravityWalker.py

+ 20 - 16
direct/src/showbase/GravityWalker.py

@@ -180,8 +180,8 @@ class GravityWalker(DirectObject.DirectObject):
         # set up floor collision mechanism
         # set up floor collision mechanism
         self.lifter = CollisionHandlerGravity()
         self.lifter = CollisionHandlerGravity()
         self.lifter.setGravity(32.174 * 2.0)
         self.lifter.setGravity(32.174 * 2.0)
-        self.lifter.setInPattern("enterRay-%in")
-        self.lifter.setOutPattern("exitRay-%in")
+        #self.lifter.setInPattern("enterRay-%in")
+        #self.lifter.setOutPattern("exitRay-%in")
         self.lifter.setOffset(floorOffset)
         self.lifter.setOffset(floorOffset)
 
 
         # Limit our rate-of-fall with the lifter.
         # Limit our rate-of-fall with the lifter.
@@ -196,11 +196,12 @@ class GravityWalker(DirectObject.DirectObject):
         """
         """
         Set up the collision sphere
         Set up the collision sphere
         """
         """
-        # This is a sphere on the ground to detect barrier collisions
+        # This is a sphere on the ground to detect collisions with
+        # walls, but not the floor.
         self.avatarRadius = avatarRadius
         self.avatarRadius = avatarRadius
-        self.cSphere = CollisionSphere(0.0, 0.0, avatarRadius, avatarRadius)
+        cSphere = CollisionSphere(0.0, 0.0, avatarRadius, avatarRadius)
         cSphereNode = CollisionNode('GW.cWallSphereNode')
         cSphereNode = CollisionNode('GW.cWallSphereNode')
-        cSphereNode.addSolid(self.cSphere)
+        cSphereNode.addSolid(cSphere)
         cSphereNodePath = self.avatarNodePath.attachNewNode(cSphereNode)
         cSphereNodePath = self.avatarNodePath.attachNewNode(cSphereNode)
 
 
         cSphereNode.setFromCollideMask(bitmask)
         cSphereNode.setFromCollideMask(bitmask)
@@ -208,8 +209,8 @@ class GravityWalker(DirectObject.DirectObject):
 
 
         # set up collision mechanism
         # set up collision mechanism
         handler = CollisionHandlerPusher()
         handler = CollisionHandlerPusher()
-        handler.setInPattern("pusher_enter%in")
-        handler.setOutPattern("pusher_exit%in")
+        #handler.setInPattern("pusher_enter%in")
+        #handler.setOutPattern("pusher_exit%in")
 
 
         handler.addCollider(cSphereNodePath, self.avatarNodePath)
         handler.addCollider(cSphereNodePath, self.avatarNodePath)
         self.pusher = handler
         self.pusher = handler
@@ -219,11 +220,14 @@ class GravityWalker(DirectObject.DirectObject):
         """
         """
         Set up the collision sphere
         Set up the collision sphere
         """
         """
-        # This is a sphere on the ground to detect barrier collisions
+        # This is a sphere a little larger than the wall sphere to
+        # trigger events.
         self.avatarRadius = avatarRadius
         self.avatarRadius = avatarRadius
-        self.cSphere = CollisionSphere(0.0, 0.0, avatarRadius-0.1, avatarRadius*1.04)
+        cSphere = CollisionSphere(0.0, 0.0, avatarRadius-0.1, avatarRadius*1.04)
+        # Mark it intangible just to emphasize its non-physical purpose.
+        cSphere.setTangible(0)
         cSphereNode = CollisionNode('GW.cEventSphereNode')
         cSphereNode = CollisionNode('GW.cEventSphereNode')
-        cSphereNode.addSolid(self.cSphere)
+        cSphereNode.addSolid(cSphere)
         cSphereNodePath = self.avatarNodePath.attachNewNode(cSphereNode)
         cSphereNodePath = self.avatarNodePath.attachNewNode(cSphereNode)
 
 
         cSphereNode.setFromCollideMask(bitmask)
         cSphereNode.setFromCollideMask(bitmask)
@@ -241,11 +245,12 @@ class GravityWalker(DirectObject.DirectObject):
         """
         """
         Set up the collision sphere
         Set up the collision sphere
         """
         """
-        # This is a sphere on the ground to detect barrier collisions
+        # This is a tiny sphere concentric with the wallSphere to keep
+        # us from slipping through floors.
         self.avatarRadius = avatarRadius
         self.avatarRadius = avatarRadius
-        self.cSphere = CollisionSphere(0.0, 0.0, avatarRadius, 0.01)
+        cSphere = CollisionSphere(0.0, 0.0, avatarRadius, 0.01)
         cSphereNode = CollisionNode('GW.cFloorSphereNode')
         cSphereNode = CollisionNode('GW.cFloorSphereNode')
-        cSphereNode.addSolid(self.cSphere)
+        cSphereNode.addSolid(cSphere)
         cSphereNodePath = self.avatarNodePath.attachNewNode(cSphereNode)
         cSphereNodePath = self.avatarNodePath.attachNewNode(cSphereNode)
 
 
         cSphereNode.setFromCollideMask(bitmask)
         cSphereNode.setFromCollideMask(bitmask)
@@ -253,8 +258,8 @@ class GravityWalker(DirectObject.DirectObject):
 
 
         # set up collision mechanism
         # set up collision mechanism
         handler = CollisionHandlerPusher()
         handler = CollisionHandlerPusher()
-        handler.setInPattern("pusherFloor_enter%in")
-        handler.setOutPattern("pusherFloor_exit%in")
+        #handler.setInPattern("pusherFloor_enter%in")
+        #handler.setOutPattern("pusherFloor_exit%in")
 
 
         handler.addCollider(cSphereNodePath, self.avatarNodePath)
         handler.addCollider(cSphereNodePath, self.avatarNodePath)
         self.pusherFloor = handler
         self.pusherFloor = handler
@@ -298,7 +303,6 @@ class GravityWalker(DirectObject.DirectObject):
         assert(self.debugPrint("deleteCollisions()"))
         assert(self.debugPrint("deleteCollisions()"))
         del self.cTrav
         del self.cTrav
 
 
-        del self.cSphere
         self.cWallSphereNodePath.removeNode()
         self.cWallSphereNodePath.removeNode()
         del self.cWallSphereNodePath
         del self.cWallSphereNodePath
         # self.cFloorSphereNodePath.removeNode()
         # self.cFloorSphereNodePath.removeNode()