collider : accept event

Hello,

I am trying to manage collision with lot of object.
In my game, I will have several bullets, and ships.

I wish to use collision events, using something like in manual

  self.accept('car-into-rail', handleRailCollision)

But I don’t understand how Panda determines which object is type “car” and which “rail”?
It seems that is name of collision node:

cNode=CollisionNode("car")

But can I have lot of collisionNode with same name?
How to do difference between the collisionNode? By tagging the collisionNodes?

What I’ve done and others questions:

I got a “zone” class where I did this

self.collider=CollisionTraverser()  
			self.colliderQueue=CollisionHandlerQueue()
			self.hdlCollider=CollisionHandlerEvent()
			self.hdlCollider.addInPattern('into-%in')
			self.hdlCollider.addOutPattern('outof-%in')

self.accept( 'into-asteroid' , self.testcollideasteroid)
self.accept( 'into-bullet' , self.testbullet)

	def testcollideasteroid(self,collEntry):
		target=collEntry.getFromNodePath()
		source=collEntry.getIntoNodePath()
		print "Zone::testcollideasteroid #############"
		print source
		print source.getParent().getName()
		print source.getTag("objname")
		print "Zone::testcollideasteroid @@@@@@"
		print target.getParent().getName()
		print target.getTag("objname")
		print "Zone::testcollideasteroid #############"

def run(self):
  self.collider.traverse(render)
...

I got other object, like asteroid which are creating collisionNode

	bounds = obj.getChild(0).getBounds()
	center = bounds.getCenter()
	radius = bounds.getRadius()*radius

	
	collSphereStr="asteroid"
	cNode=CollisionNode(collSphereStr)
	cNode.addSolid(CollisionSphere(center, radius ) )
	cNodepath=obj.attachNewNode(cNode)

In my zone, when I got a new object to collide :

...
for objColl in objToCollide.keys():
   self.collider.addCollider(objToCollide[objColl] , self.hdlCollider)

Is that ok, If I have my accept, before to have the collisionNode added to my collider?

In fact, for the moment, I got nothing happen… :cry:

trying to solve my problem… I put here my thinks.

In fact, I got 2 zones in my game.
In each class, I create a traverser and a eventhandler.

self.collider=CollisionTraverser()
self.hdlCollider=CollisionHandlerEvent()

My two zones don’t want to have commun collider and event, because they manage their own objects.

Today, when I fire a bullet, it collides with object of the two zones… so bad.

It seems you can give a name to collisionTraverser

self.collider=CollisionTraverser("zone1")

but not on hdlCollider.
when I do CollisionHandlerEvent(), I grab always the same handler, and not each time an specific instantiation…

What do I miss?

Thank you
[/code]