collisionHandlerEvent and collisionHandlerPusher problem :s

Hi, I’m trying to make a code where I use both collisionHandlerPusher and collisionHandlerEvent:

self.pusher1 = CollisionHandlerPusher()
self.pusher1.addCollider(self.csNode1, self.staticModel)

    self.pusher2 = CollisionHandlerEvent()
    self.pusher2.addInPattern("char-into-ini1")
    
    self.traverser = CollisionTraverser("trav")
    base.cTrav = self.traverser
    self.traverser.addCollider(self.csNode1, self.pusher1)
    self.traverser.addCollider(self.csNode1, self.pusher2)

but, I can’t seem to run both handlers…I tried to look in other topics, but the only one I found was this one: discourse.panda3d.org/viewtopic.php?t=4439
but I couldn’t understand. can anyone help me with these?

You can’t have two handlers on the same collider object. However, you don’t need to: a CollisionHandlerPusher is a CollisionHandlerEvent. Just use a CollisionHandlerPusher, and call addInPattern on that.

David

But in my game, I am using the collisionpusher for walls and the collisionevent when the player hit an enemy. This solution would work in this game?

You have to use collidemasks to arrange which objects register collisions with which other objects. For instance, to separate environ collisions from player event collisions you set a bitmask of 0 for the environ (all nodes you want the pusher to work on) and a bitmask of 1 for all others. I’m pretty sure you will have to make 2 collision nodes on your character to do this though. We did much the same thing in our WhiteWash game that is in the showcase (but we weren’t smart enough to use one handler), so if the link still works there is an example of exactly what you sound like you are looking for.

~Silver~