def buildCollisions(self): TrapGag.buildCollisions(self) gagSph = CollisionSphere(0, 0, 0, 1) gagSph.setTangible(0) gagNode = CollisionNode('gagSensor') gagNode.addSolid(gagSph) gagNP = self.entity.attachNewNode(gagNode) gagNP.setScale(0.75, 0.8, 0.75) gagNP.setPos(0.0, 0.1, 0.5) gagNP.setCollideMask(BitMask32.bit(0)) gagNP.node().setFromCollideMask(CIGlobals.FloorBitmask) event = CollisionHandlerEvent() event.setInPattern("%fn-into") event.setOutPattern("%fn-out") base.cTrav.addCollider(gagNP, event) self.avatar.acceptOnce('gagSensor-into', self.onCollision)
def buildCollisions(self): TrapGag.buildCollisions(self) gagSph = CollisionSphere(0, 0, 0, self.collRadius) gagSph.setTangible(0) gagNode = CollisionNode('gagSensor') gagNode.addSolid(gagSph) gagNP = self.gag.attachNewNode(gagNode) gagNP.setScale(0.75, 0.8, 0.75) gagNP.setPos(0.0, 0.1, 0.5) gagNP.setCollideMask(BitMask32.bit(0)) gagNP.node().setFromCollideMask(CIGlobals.WallBitmask | CIGlobals.FloorBitmask) event = CollisionHandlerEvent() event.set_in_pattern("%fn-into") event.set_out_pattern("%fn-out") base.cTrav.addCollider(gagNP, event) if self.isLocal(): self.avatar.accept('gagSensor-into', self.onCollision)