Physics.Raycast not working

Hello,
I’m making an FPS controller, and in this part of script, I’m trying to achieve that when the player jumps and is moving some direction, he will continue moving in that direction, but only if nothing’s in his way.
So I used Rays and Physics.Raycast(ray, length), but it didn’t seem to work, so I permitted infinite Physics.Raycast(ray), but it didn’t work either.
So, I have two questions:

  1. How long is actually the length of ray? Just say something like: “The length 1 is as long as the default primitive Unity cube game object.”
  2. Why doesn’t this work?

Thanks.

The length 1 is as long as the default primitive Unity cube game object: 1 unit. (It’s also the length from (0|0|0) to (1|0|0) in the editor. It’s just using the Unity coordinate system.)

You don’t mention how exactly it “doesn’t work”. Does it never hit anything? Maybe you start from the wrong position?

To debug it, I recommend using Debug.DrawRay to check where your ray actually is in the Unity editor.