Collision problems...Ray works but Segment does not

Hey everyone. Was hoping you can help me out. I’m having a little problem with my CollisionSegment colliding with everything O.o; Heres a image of what it looks like. I do disable it after I shoot, but for testing reason I left it on. As you can see, it’s testing everything it can when it should probablly just be testing what it hits or closes to.

img293.imageshack.us/img293/3665/collisiond.png

Heres the code ish~ If you need more information, I can get more. Um, the collision evniron is made from the octtree scrip with bit 0 and 3, the CollisionSegment has bit 3 and other players have bit 3. Player has bits 0-2

#Collision ray for our Weapon.
self.pickerNode=CollisionNode('mouseRay')
self.pickerNP=self.anp.attachNewNode(self.pickerNode)
self.pickerNode.setFromCollideMask(BitMask32.bit(3))
self.pickerNode.setIntoCollideMask(BitMask32.allOff())
self.pickerRay=CollisionSegment(0,0,0,0,750,0)
#Check who we hit.
self.pickerNode.addSolid(self.pickerRay)
base.cTrav.addCollider(self.pickerNP, base.handler)
base.cTrav.addCollider(self.pickerNP, base.handlerQueue)
self.mpos=base.mouseWatcherNode.getMouse()
self.pickerRay.setFromLens(base.camNode, self.mpos.getX(), self.mpos.getY())
base.cTrav.traverse(render)
if base.handlerQueue.getNumEntries() > 0:
  base.handlerQueue.sortEntries()
  self.pickedObj=base.handlerQueue.getEntry(0).getIntoNodePath()
  if not self.pickedObj.isEmpty():
    if str(self.pickedObj.getParent().getParent().getName()) in self.userlist:
      if self.userlist[str(self.pickedObj.getParent().getParent().getName())].getDistance(self.anp) <= self.BullitMaxDis:
        #print self.userlist[str(self.pickedObj.getParent().getParent().getName())].getPos()
        #print self.pickedObj.getParent().getParent().getName()
        self.OtherPlayersName = str(self.pickedObj.getParent().getParent().getName())
#base.cTrav.removeCollider(self.pickerNP)
#self.pickerNode.clearSolids()

It’s just a question of bounding volumes. The showCollisions() function lights up in yellow all surfaces whose bounding volume is intersecting the segment’s bounding volume.

The bounding volume of a segment is, by default, the sphere that encloses the segment, which might be quite large for a long segment. The bounding volume of a ray is, on the other hand, the infinite line that matches the ray (but in both directions). If the ray is a better fit for your bounding volume, then just use a ray instead of a long segment (you can always check the point of collision and discard something too far away if you like). Or, I believe you can use a segment, and reset the bounding volume to be a BoundingLine by hand.

David