RR Ground Collision

In reference to Roaming Ralph’s coding…

Just wondering why this is considered an “inefficient method”. Is this because of the way it behaives when there are polygons above the actor’s position?

It’s because collision with a large geometry is slow, even ray collision. It’s much better to have a heightmap of the terrain so you can check the height of the terrain from the heightmap image.

Also, it might be because it doesn’t use CollisionHandlerFloor, which takes care of setting ralph’s Z on the terrain automatically.

Is there a good working example of those?

I’m playing around with different collisions trying to see how they work.

I can’t seem to get RR’s raycollision to work, it seems it doesn’t recognize my terrain as a collidable object.

        self.environ = loader.loadModel("models/environment2")
        self.environ.reparentTo(render)
        self.environ.setPos(0,0,0)
        self.environ.setScale(1,1,1)
        ...
        ...
        ...
        self.pandaActor = Actor.Actor("models/panda-model",{"walk":"models/panda-walk4"})
        self.pandaActor.setScale(0.005,0.005,0.005)
        self.pandaActor.setPos(0,0,0)
        self.pandaActor.setHpr(0,0,0)
        self.pandaActor.reparentTo(render)
        ...
        ...
        ...
        self.cTrav = CollisionTraverser()
        
        self.PaGroundRay = CollisionRay(0,0,1000,0,0,-1)
        self.PaGroundCol = CollisionNode('PaRay')
        self.PaGroundCol.addSolid(self.PaGroundRay)
        self.PaGroundCol.setFromCollideMask(BitMask32.bit(0))
        self.PaGroundCol.setIntoCollideMask(BitMask32.allOff())
        self.PaGroundColNp = self.pandaActor.attachNewNode(self.PaGroundCol)
        self.PaGroundHandler = CollisionHandlerQueue()
        self.cTrav.addCollider(self.PaGroundColNp, self.PaGroundHandler)
        ...
        ...
        ...
        entries = []
        for i in range(self.PaGroundHandler.getNumEntries()):
            entry = self.PaGroundHandler.getEntry(i)
            entries.append(entry)

        print entries

I added the { Polyset keep descend } code to the ground nodes, but I get empty array values upon executing the code

Thanks.