collisionRay Help

Hi everyone, I’m trying to make a 3d person character to jump. I’m trying to use the collisionRay and the CollisionHandlerFloor, but it doesn’t seem to work, I’ve read the Panda3D Manual, here’s the piece of code of the collision (all of this code is inside a class, but in diferent functions):

self.actor1 = Actor(“panda”, {“walk”:“panda-walk”})
self.actor1.setScale(.5, .5, .5)
self.actor1.reparentTo(render)
self.actor1.setPos(0, 20, 0)
self.actor1.pose(“walk”, self.staticPose)

self.env = loader.loadModel(“environment”)
self.env.reparentTo(render)
self.env.setScale(0.25,0.25,0.25)
self.env.setPos(0, 20, 0)

raio = CollisionRay(0, 0, 0, 0, 0, -2)
self.raioNode1 = self.env.attachNewNode(CollisionNode(“collisionNode3”))
self.raioNode1.node().addSolid(raio)
self.raioNode1.show()

    self.floor = CollisionHandlerFloor()
    self.floor.addCollider(self.raioNode1, self.actor1)
    self.floor.setMaxVelocity(1)
    self.traverser = CollisionTraverser("trav")
    base.cTrav = self.traverser

    self.traverser.addCollider(self.raioNode1, self.floor)

CHFloor doesn’t allow a jump. It directly puts the node exactly at the collision point.
Try CHGravity.

To make your character jump, after creating a CRay and a CHandlerGravity,
just use

yourCHandlerGravity.setGravity(#value)

and

yourCHandlerGravity.setVelocity(#otherValue)

This makes very nice jumps.

If your problem is the setup of the ray+handler, just read carefully the manual