I’m trying to get the CollisionFloorHandler working with the Ralph character…I currently have:

ralph2 = loader.loadModel("../../../assets/eggFiles/characters/ralph/ralph")
self.ralphFromObject = ralph2.attachNewNode(CollisionNode('ralphCollNode'))
self.lifter = CollisionHandlerFloor()"lifter offset:%s", self.lifter.getOffset())"lifter reach:%s", self.lifter.getReach())
self.lifter.addCollider(self.ralphFromObject, ralph2)

When I run my application, Ralph just sits 2 units above the ground without falling at all…is there something else I’m supposed to be registering here? For example, registering the actual terrain that Ralph is supposed to land on?


floorHandler = CollisionHandlerFloor()
ralphRay = ralph.attachNewNode(CollisionNode('name'))
ralphRay.node().addSolid(CollisionRay(0, 0, 1000, 0, 0, -1)) # make sure the Z value is higher than the highest point of the terrain
ralphRay.node().setFromCollideMask(BitMask32.AllOn()) # tell the collision system that ray must collide with everything
ralphRay.node().setIntoCollideMask(BitMask32.allOff()) # this ray shouldn't be a INTO object
floorHandler.addCollider(ralphRay, ralph)

# start the collisions with the floorHandler and collisionRay
base.cTrav.addCollider(ralphRay, floorHandler)

as simple as that, so basically, # make sure the Z value is higher than the highest point of the terrain It seems you have set it to 0, so it might be the cause. basically, the origin of the ray is below the terrain and they ray is “looking down” so it can’t see the terrain to collide with it. If there are no collision, floorhandler doesnt do anything (Ralph doesnt fall into an abyss, which is a good thing).

Thanks for the response - creating the CollisionTraverser and raising the ray seemed to solve that issue.

Is there any reason that this same setup should not work for an Actor? as opposed to just a single model? When I try it with a walking animation my character ends up shooting straight into the air during the walk cycle…I think it happens when the walk cycle loops to the next iteration…any ideas?