another collision problem

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

my code:

# 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.
thanks!!

willeke

Too bad, you have to be a victim of the unclear manual.
I don’t know why the manual doesn’t even explain the very simple thing first.

In order to use Panda’s collision system, you have to set up the collision solids and the nodes’ collision bitmask. Next, in your main loop, you should check if any collision takes place. You do this by telling the CollisionTraverser to walk through (traverse) the scenegraph, looking for any from and into node whose collision bitmasks match. If you use “base.cTrav=CollisionTraverser()”, you don’t have to call traverse() for yourself, otherwise you have to call “self.traverser.traverse(render)” everytime you need to check for collision.

Then, after the traversal, the result would be sent to some various CollisionHandler you might use. So, you should check the collision entries each time exactly after collision traversal.

In your code, you do the setup, the traversal and entries checking only once in 1 single frame. While in your main loop, I assume you don’t do anything related to collision. Then what do you expect to be happen ?
To fix that, move the collision traversal and entries checking to your main loop.