One-way Floor

Hello All-
I’m new to the Panda3D scene and I’m having some collision issues. Forgive me, because I have seen many threads of this sort around, and I assume you are all sick of the subject.

Anyway, the problem is that my character will travel down a plane (terrain) with no problem, but when I try to go up any sort of incline, the character fails to travel up the plane. I believe this problem is caused by the CollisionRay that I’m using to detect said collisions. It originates at point (0,0,0). I would put it higher, but when I do, the character flips out at the first change in the terrain. What am I missing?

Relevant Code:

    self.environ = loader.loadModel("models/arena2.egg")      
    course = self.environ.find('**/Plane')
    Wall = self.environ.find('**/Wall')

    self.Doll = Actor("models/VoodooDoll",
    self.cTrav = CollisionTraverser()
    DollRay = self.Doll.attachNewNode(CollisionNode('colNode'))
    lifter = CollisionHandlerFloor()
    lifter.addCollider(DollRay, self.Doll)

    self.cTrav.addCollider(DollRay, lifter)

Thanks in advance!

This works :

just to avoid the searching.
shouldnt the following work?


I just tried your suggestion, and it didn’t work out. Any value over “0” for the “z” coordinate of the ray will cause the collision to act inappropriately.


Well, what, precisely, does it do? Does it jump about randomly? End up too far down? To one side?

Hmm… Having gone back to look at your code, are you perhaps receiving an error message in the console? I notice that you don’t seem to be setting the ray’s “into” mask to 0 (i.e. all off), and as I recall rays aren’t allowed to be “into” objects.

Using Thomas’s fix, the avatar ends up to far under the ground. Originally, with any value over “0” for Z, the avatar would bounce around then end up maybe fifty units under the ground.


Hmm… While the symptoms that you describe don’t seem to quite match it, perhaps your problem is related to that mentioned here?

However, the “bouncing around” sounds to me as though it were detecting collisions at positions other than the floor, or were getting incorrect readings on the floor…

The falling sounds as though the ray is not detecting the floor at all, perhaps either because of the ray “slipping through” joints between polygons or because of numerical inaccuracy when the ray starts at the floor’s z-value.

Have you tried my sample code ? Scroll up.