My Raycast (From Screenpoint) gets shorter when I face down, like it's being occluded. But it's not.

The problem is simple. I want to cast a ray whenever the player clicks the mouse button. This much works perfectly. The ray even extends from the cursor’s position, four units forward, and records anything that it hits.

But when you look down, and not forward or up, the rays stop before they hit the ground. (Or even get close) It’s like something is blocking them. I’ve checked everything, and I don’t have any colliders attached to the player that they would be hitting, so I’m totally confused.

![alt text]
[1]

There’s a picture demonstrating the behavior. Notice that the higher up my angle is, the ray is longer, like it should be.
And following, is a snip of code. I’m not sure what help that would be, but if it is of any help, it’s there.

function CastRay () {
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;

	if (Physics.Raycast (ray, hit, 4)) {
	
	Debug.DrawLine (ray.origin, hit.point, Color.red,30);
//Rest of code is here, just a bunch of stuff checking the tags of the objects hit and then performing various other things unrelated to the ray.

Debug.DrawLine has a 5th parameter, depthTest, which’s true by default - it enables depth test, so that the ray or line isn’t rendered behind other objects. Add a false to Debug.DrawLine to deactivate depth test - like this:

    Debug.DrawLine (ray.origin, hit.point, Color.red, 30, false);