Character Jumping Problems (Stuck in Ceiling)

I’m working on a game right now and I’ve run into a problem with the character physics type, specifically with the jump feature. It works perfectly, but whenever the top of my character touches the ceiling, it gets stuck in an endless up-and-down motion, jumping then falling down but not quite far enough to escape the ceiling. This happens regardless of whether I’m holding the jump key or whether I press the jump key while in the process of colliding with the ceiling. Note that if I let go of the jump key while this is happening everything is fine, I just fall out of the ceiling.

Is there a simple way to fix this that I’m just not realizing? I’ve tried changing the shape of the collision mesh, more physics sub steps but nothing really seems to work.

ray -z 2 units-------and------Jump
keypress------------/

no jump unless feet on ground?

Thanks for the reply! That works great, in case anyone is curious and looking at this thread later, I ended up using a radar sensor instead of a ray sensor so that if the character is standing on the edge of an object it’ll still register as “on the floor” and be able to jump.