i’m trying to understand collisions but it’s not working so far. my guess is that i miss something really simple but can’t figure it out.
i made a small scene with a wall and a floor.
the camera is the ‘walking’ object (kinda FPS) and moves around with the keyboard.
i attached a collisionSpere to the camera as a from object and the wall as into object.
in the code i made collisions visible and let the collisionqueue print itself but as the camera move ‘into’ the wall nothing show or get printed.
this is made with te ball in maze exsample and the manual…
searched the forum but didn’t really find what i was looking for
# the collision solid for the wall colwall = environ.find("**/colbox") colwall.node().setIntoCollideMask(BitMask32.bit(0)) colwall.show() # attach spere to camera self.fromObject = base.camera.attachNewNode(CollisionNode('colNode')) self.cs =CollisionSphere(5, 50, 0, 3) self.fromObject.node().addSolid(self.cs) self.fromObject.node().setFromCollideMask(BitMask32.bit(0)) self.fromObject.node().setIntoCollideMask(BitMask32.allOff()) self.fromObject.show() # the collision queue self.queue = CollisionHandlerQueue() #collision traverser self.traverser = CollisionTraverser() self.traverser.addCollider(self.fromObject, self.queue) self.traverser.traverse(render) self.traverser.showCollisions(render) for i in range(self.queue.getNumEntries()): entry = self.queue.getEntry(i) print entry
edit: i forgot to mention that i made the collisionsolids visible and i can both see the wall and the camera solid.
somebody please help me understand this.