I am very new at panda and I am having some problems with collision.
I am trying to create a game where the user will be able to move around with the mouse in a fairly large town. I want to do collision detection between the camera and the scene. I cannot use the default solids to do this because my scene is very complicate. For the moment I donÂ´t care about performance.
import direct.directbase.DirectStart from pandac.PandaModules import * from direct.interval.IntervalGlobal import * base.cTrav = CollisionTraverser() pusher = CollisionHandlerPusher() #load a model (in normal case here will be the town) town= loader.loadModel('models/teapot.egg') town.reparentTo(render) town.setPos(0,150,0.5) town.setScale(10,10,10) #use the camera as a from object to detect collisions with all the geometry of the scene fromObject = base.camera.attachNewNode(CollisionNode('colNode')) fromObject.node().addSolid(CollisionSphere(0, 0, 0, 1)) fromObject.node().setIntoCollideMask(BitMask32.allOff()) fromObject.node().setFromCollideMask(GeomNode.getDefaultCollideMask()) #add collision node to the traverser and the pusher base.cTrav.addCollider(fromObject,pusher) pusher.addCollider(fromObject, base.camera, base.drive.node()) base.cTrav.showCollisions(render) run()
I can see that collisions are been made from base.cTrav.showCollisions(render) but the camera is still passing through the scene.
Am I doing something wrong here? Is there any other way to do this except ODE and OdeTriMeshGeom?