COLLISION QUESTION... NEED HELP

me and two other students are working on this spaceship game and we have 3 collision boxes on the the ship, 2 on the wings, and 1 in the middle. when a mine hits the space ship at the wing it sometimes registers that we hit the wing box and middle box which gives the ship double damage. Does any one have any idea on how we can say if the mines its one collision box dont accept the other collision boxes so the correct amount of health is taken away.

First Post!!

@shrew: you allright??.. please dont post completely useless and unrelated stuff^^

@ThEoRy: are you using a collision queue for detection or something else? … and how comes you have BOXes!? we all want to have boxes,too!

o sorry i met collision spheres

hm… well it’s hard to say how to prevent something if we dont know how you determine and calculate the hits.
best would be you post the code-snippset. if you dont want to reveal parts of your sources you could try to explain what exactly you use to calculate the hitpoints.

you might be able to simply use a variable and set it to a certain value after it collided.
like
collided = True … so if you check for the healthpoints you could ask if the ship allready collided with the mine or not and prevent further hit-point loss.

heres the code for the method that is called after a mine collides with the left side of the ship. im no pro at panda so i got my flamesuit on

def handleShipCollisionLeft(self,cEntry):
    self.leftColliding = 1
    if(self.gameOver == False):
      if(self.centerColliding == 0):
        if(self.rightColliding == 0):
          #self.mineHit.play()
          #self.shipJoltRight()
          
          if(self.undamaged == 1):
            #self.fullHealth.destroy()
            self.newHealth = self.newHealth-20
            self.undamaged = 0
            self.healthBar.setHealth(self.newHealth/100.0)
          if(self.undamaged == 0):
            self.health.destroy()
            self.newHealth = self.newHealth - 20
            self.undamaged = 0
            self.healthBar.setHealth(self.newHealth/100.0)
            if(self.newHealth <= 50):
              self.setSmoke()
            self.healthBar.setHealth(self.newHealth/100.0)
            if(self.newHealth <= 0):
              self.shipExplode()
          self.health = OnscreenText(text=str(self.newHealth),
           style=4, fg=(1,1,1,1), pos=(0,0.5), scale = 0.2)
          #self.Mines.remove(cEntry.getIntoNodePath().getParent())
          self.undamaged = 0
         
          cEntry.getIntoNodePath().getParent().remove()
          #self.Mines.remove(cEntry.getIntoNodePath().getParent())
      
    self.leftHit = self.leftHit + 1
    self.leftColliding = 0

heres the setup collisions method if that helps at all

def setupCollisions(self):    
    create the main collision handler
    self.cHandlerc = CollisionHandlerEvent()
    #add the collision registration pattern
    self.cHandlerc.addInPattern('%fn-into-%in')
    self.cTravc = CollisionTraverser()
    base.cTrav = self.cTravc
    
    #get bounds of ship and create 3 collision spheres - center left right
    bounds = self.ship.getChild(0).getBounds()
    center = bounds.getCenter()
    radius = bounds.getRadius()
    cSpherec = CollisionSphere(center+(Vec3(0,0.5,0)),radius-2.4)
    cSpherel = CollisionSphere(center+(Vec3(-1.5,-0.8,0)),radius-2.5)
    cSpherer = CollisionSphere(center+(Vec3(1.5,-0.8,0)),radius-2.5)
    cSpherelbuffer = CollisionSphere(center+(Vec3(1.5,0.2,0)),radius-2.8)
    cSphererbuffer = CollisionSphere(center+(Vec3(-1.5,0.2,0)),radius-2.8)
    
    #add the spheres to empty nodes
    cNodec = CollisionNode("shipc")
    cNodel = CollisionNode("shipl")
    cNoder = CollisionNode("shipr")
    cNodelbuffer = CollisionNode("shipr")
    cNoderbuffer = CollisionNode("shipr")
    
    cNodec.addSolid(cSpherec)
    cNodel.addSolid(cSpherel)
    cNoder.addSolid(cSpherer)
    cNodelbuffer.addSolid(cSpherelbuffer)
    cNoderbuffer.addSolid(cSphererbuffer)
    
    cNodec.setIntoCollideMask(BitMask32.allOff())
    cNodel.setIntoCollideMask(BitMask32.allOff())
    cNoder.setIntoCollideMask(BitMask32.allOff())
    cNoderbuffer.setIntoCollideMask(BitMask32.allOff())
    cNodelbuffer.setIntoCollideMask(BitMask32.allOff())
    
    #attach the nodes to the cNodePaths
    self.cNodePathc = self.ship.attachNewNode(cNodec)
    self.cNodePathl = self.ship.attachNewNode(cNodel)
    self.cNodePathr = self.ship.attachNewNode(cNoder)
    self.cNodePathrbuffer = self.ship.attachNewNode(cNoderbuffer)
    self.cNodePathlbuffer = self.ship.attachNewNode(cNodelbuffer)
    #show the collision spheres
    self.cNodePathc.show()
    self.cNodePathl.show()
    self.cNodePathr.show()
    self.cNodePathrbuffer.show()
    self.cNodePathlbuffer.show()
    #add the completed cNotePaths to the collision traverser
    self.cTravc.addCollider(self.cNodePathc,self.cHandlerc)
    self.cTravc.addCollider(self.cNodePathl,self.cHandlerc)
    self.cTravc.addCollider(self.cNodePathr,self.cHandlerc)
    self.cTravc.addCollider(self.cNodePathrbuffer,self.cHandlerc)
    self.cTravc.addCollider(self.cNodePathlbuffer,self.cHandlerc)

    self.accept("shipl-into-mine",self.handleShipCollisionLeft)
    self.accept("shipc-into-mine",self.handleShipCollisionCenter)
    self.accept("shipr-into-mine",self.handleShipCollisionRight)