Collision events

Dear folks,

why are my collissions not detected. I set the collision setup as shown in the manual. I see my Into objects changing colour when the Ball is colliding with them but not the funny red and white things. and the handling code is not called.

PLS advice

cheers

Martin

#-------------------------------------------------------------------------------
        #initialize traverser
        base.cTrav = CollisionTraverser()
        base.cTrav.showCollisions(render)
        #initialize collision handlers
        self.cHandEvent = CollisionHandlerEvent()
        self.cHandEvent.addInPattern('-into-')
        self.cHandEvent.addAgainPattern('-again-')
        self.cHandEvent.addOutPattern('-out-')
        
        self.cCount=0

        base.cTrav.addCollider(self.TubePusher, self.cHandEvent)
        
        self.accept('-into-', self.cIn)
        self.accept('-again-', self.cAgain)
        self.accept('-out-', self.cOut)
 
    def InsertCharacter(self):        
        self.CPosition = loader.loadModel("models/Ball1")
        self.CPosition.setShaderInput("texDisable",1,1,1,1)
        self.CPosition.setPos(0,0,10)
        self.CPosition.reparentTo(render)
        
 
        
        #++
        self.CTube = CollisionTube(0, 0, 0, 0, 0, -10, 0.75) #1.5 TubeRadius
        self.cNode2 = CollisionNode('TubePusher')
        self.cNode2.addSolid(self.CTube)        
        
        self.TubePusher = self.CPosition.attachNewNode(self.cNode2)        
        self.TubePusher.show()
        

 
        #End Insert Character
  
   def cIn(self,collisionEntry):
        normal = collisionEntry.getSurfaceNormal(render)
        self.inst8.setText('In'+str(normal))
        return True        
        
    def cAgain(self,collisionEntry):
        normal = collisionEntry.getSurfaceNormal(render)
        self.inst7.setText('Again'+str(normal))
        return True
        
    def cOut(self,collisionEntry):
        normal = collisionEntry.getSurfaceNormal(render)
        self.inst6.setText('Out'+str(normal))
        return True

You must be getting error messages on the console about it ignoring your CollisionTube, because CollisionTube has no intersection test defined for CollisionPolygon (or some such message).

This message is telling you that you can’t use a CollisionTube as a “from” solid. You have to use a CollisionSphere instead.

David

Thank you

I was working in Boa so the console never showed up

MArtin