Question about collisions

Hi, I am programming a client-server application, right now the server creates monsters and move then around, interpolating positions.
The next thing to finish the movement is to add collision management, but my code is not working…

Here is how I create the collision part of the monsters:

self.model = Actor("samples/Roaming-Ralph/models/ralph",					{"run":"samples/Roaming-Ralph/models/ralph-run",					 "walk":"samples/Roaming-Ralph/models/ralph-walk"})
self.model.setScale(0.5, 0.5, 0.5)
self.model.setPos(self.getPosX(), self.getPosY(), 0)
self.groundSphere = CollisionSphere(0, 0, 2.5, 2)
self.groundCol = CollisionNode('monster '+str(' Ray')
self.groundColNp = self.model.attachNewNode(self.groundCol)
self.colissionQueue = CollisionHandlerQueue()

In the main code I start the collision Travasser as:

self.collisionMngr = CollisionTraverser()

And I start the monsters this way:

for i in range (10):
    self.monsterList.append(monster(i, random.randrange(-20, 20, 1), random.randrange(-20, 20, 1), i))
    self.collisionMngr.addCollider(self.monsterList[i].getGroundColNp(), self.monsterList[i].getColissionQueue())

Right now I am drawing the monsters and their collision spheres to see when they collide. Still, when two monsters collide, nothing is added to their queues. Could anyone point me what am I doing wrong?

Also, i want to ask this: since the server was a windowless application (due to performance), do I need to draw the models to in order to make the collision work? In negative case, should I just set the window-type to None or should I also remove the reparentTo(render) of the models?

Thanks in advance.

Are you ever calling self.collisionMngr.traverse()? If not, collisions will never be detected. Or you can use base.cTrav instead of self.collisionMngr to have this called for you automatically.

window-type none is sufficient to disable rendering for performance.


It works now, thank you very much.