Collision Detection system is not working.

base.cTrav = CollisionTraverser()
self.notifier = CollisionHandlerEvent()
self.notifier.addInPattern("%fn-into-%in")

self.accept(“bullet-into-zombie”, self.zombie_shot)

col = self.zombie.attachNewNode(CollisionNode(“z”))
col.node().addSolid(CollisionTube(0, 0, 10, 0, 0, -10, 100))

def zombie_shot(self, entry):
self.zombie.removeNode()

def shoot(self):
if self.firing == 0:
self.fire.start()
self.firing = 1
self.taskMgr.doMethodLater(.4, self.reset_fire, “reset fire”)
self.bullet = render.attachNewNode(CollisionNode(“bullet”))
self.bullet.node().addSolid(CollisionRay(Point3(self.cam.getPos()), Vec3(self.cam.getHpr())))
base.cTrav.addCollider(self.bullet, self.notifier)
self.bullet.show()

And I did indent the shoot method.

Then when I shoot the zombie, he does not dissapear, what’s going on?

tip: you can use [code ] and [/code ] (without the extra space) to preserve indentation.

i don’t see you calling self.eTrav.traverse() anywhere. this call would make panda calculate the actual collisions

But robberguy189 is using base.cTrav - doesn’t that automatically traverse?

Hmm… I think that I may see the issue: your event code is looking for “bullet-into-zombie” (emphasis mine), but you’ve named your zombie’s node just “z” - what happens if you name your zombie “zombie”?

It’s indeed happening what Thaumaturge says… either you change the self.accept(“bullet-into-zombie”) to self.accept(“bullet-into-z”) or the CollisionNode’s name from “z” to “zombie”

This works like a charm, thanks a lot!