Ray Sensor not Working

A: Move left
D: Move right

I’m trying to make it so the cube will go down a slope if it’s on one, which means that only one of either bottom corner is touching the ground. I put ray sensors on both sides of the object, detecting the ground, but only the left one seems to work. When moving left, the object does not follow the ground.

Every test I’ve done says that the right ray is just inactive. What’s going on? How can I amend this?


dynamic-character.blend (532 KB)

The issue is this:
if left:
ray = left.hitNormal
o[‘foot’] = str(left)

left will always be true because its assigned the sensor. Just change it to:
if left.positive:
ray = left.hitNormal
o[‘foot’] = str(left)

Late-night coding, yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaay~! :o

Now I just have to figure out why the box is hopping off the downward inclines when it’s close to (but not quite at) a level surface.

Got it.


dynamic-character.blend (602 KB)