Push some collisions, not others?

Hi, I have a simple game I’m working on where the player is a sphere and there are boxes (houses) on the ground. I have been able to use the CollisionHandlerPusher class to prevent the player from walking through buildings.

However, I am now trying to add a new feature: when the player is close enough to a house, the door opens. To do this, I have added a collision sphere to the house. I want the player to be able to walk through this sphere (this sphere just detects if the player is close enough for the door to open).

However, because of the way the CollisionHandlerPusher handles collisions, this sphere is pushing the player as well. Any suggestions?

My code basically looks like this:

house = loader.loadModel(‘house’)
house.setPos(0, 10, 0)
houseNode = house.attachNewNode(CollisionNode(‘wallnode’))
south_wall = CollisionPolygon # appropriate arguments here

similar code for other walls

player = loader.loadModel(‘player’)
player.setPos(0, 0, 0)

fromObject = player.attachNewNode(CollisionNode(‘playernode’))
fromObject.node().addSolid(CollisionSphere(0, 0, 0, 1))

pusher = CollisionHandlerPusher()
pusher.addCollider(fromObject, player)

base.cTrav = CollisionTraverser()
base.cTrav.addCollider(fromObject, pusher)

Sorry if this is in the wrong place, let me know where it should go

Perhaps better: stick with a single handler and player solid, and call “setTangible(False)” on your “door” solid. That should allow you to receive the event from the handler without it acting as though solid (if I’m not much mistaken CollisionHandlerPusher inherits from CollisionHandlerEvent, meaning that it can register events).

Original suggestion:

My suggestion is to have two handlers, one your pusher and the other a CollisionHandlerEvent, two sets of collision geometry for your characters, one for physics and one for events, and then use bitmasks to distinguish which collision shapes are intended to interact with which others.