Raycast not interacting.

I’ve used raycasts many time before and never had an issue, but for somereason, in this project specifically. Raycasts refuse to function.

Collision matrix is properly setup.
Objects/terrain has colliders
Layermask is set up, set to everything in test.

    void FixedUpdate()
    {
        if (Physics.Raycast(transform.position, Vector3.down * 50, out hit, 1f, layerMask))
        {
            Debug.DrawRay(transform.position, Vector3.down * hit.distance, Color.green);
            Debug.Log("HIT");
        }
        else
        {
            Debug.DrawRay(transform.position, Vector3.down * 50, Color.red);
        }
    }

Any ideas on any external elements that might cause raycasts to never return hits?

Draw ray whether or not the ray actually returns a hit. Just before you raycast.

Vector down * 50 and distance of 1

vector down and distance of 50?

nevermind im an idiot, i didnt see that max was set to 1, fml

yeah i noticed shortly after posting that after tearing my hair out.

1 Like