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")      
    self.environ.reparentTo(render)
    self.environ.setPos(0,0,0)
    course = self.environ.find('**/Plane')
    course.setCollideMask(BitMask32.bit(1))
    Wall = self.environ.find('**/Wall')
    Wall.setCollideMask(BitMask32.bit(0))
    Wall.hide()

    self.Doll = Actor("models/VoodooDoll",
                             {"run":"models/VoodooDoll-runcycle",
                              "stand":"models/VoodooDoll-walk"})
                              
    self.Doll.reparentTo(self.environ)
    self.Doll.setPos(0,0,0)
    self.Doll.setScale(0.25,0.25,0.25)
    
    self.cTrav = CollisionTraverser()
    
    DollRay = self.Doll.attachNewNode(CollisionNode('colNode'))
    DollRay.node().addSolid(CollisionRay(0,0,0,0,0,-1))
    self.Doll.node().setIntoCollideMask(BitMask32.allOff())
    DollRay.node().setFromCollideMask(BitMask32.bit(1))
          
    DollRay.show()
    
    lifter = CollisionHandlerFloor()
    lifter.addCollider(DollRay, self.Doll)

    self.cTrav.addCollider(DollRay, lifter)

Thanks in advance!
-Hyde

This works :
discourse.panda3d.org/viewtopic.php?t=4439

just to avoid the searching.
shouldnt the following work?

DollRay.node().addSolid(CollisionRay(0,0,1,0,0,-1)) 

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.

-Hyde

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.

-Hyde

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.