Raycasting based collision detection fails on slow framerates

I’m experiencing an odd issue with my collision detection. I’m using the Update method to read input, and I have the collision detection code running in the FixedUpdate method (per the usual suggestion so that the code is always executed at a fixed rate, regardless of framerate). The fixed timestep is set at the default 0.02.

However, when the framerate is low (below 30), the collision detection doesn’t always work. The player can easily fall through the collision layer, though sometimes they don’t.

It’s my understanding that FPS shouldn’t have an effect since I’m calling the collision detection logic in FixedUpdate.

If you’d like to see the actual collision detection code, here’s a Gist to an abbreviated version.

Edit: Based on Gruffy’s comment, I rearranged some of the code so that all of the input polling occurs in Update and I perform the actual raycasting and final translation in LateUpdate, which alleviates the problem, but doesn’t completely remove it.

Do the raycasting and the input reading both in the FixedUpdate.

Why do you even read the input in the Update if you are gonna move it in FixedUpdate?