Why does my raycast sometimes appear, and other times not?

If I set the players fingers to be the transform point of origin it does appear (albeit at the wrong angle). But if I add an empty game object as a child of my player and try to shoot the ray from there, nothing shows. Could it be scaling issue? The model I used has its rig at 100 scale. (I got it online somewhere so not sure how it was exported).

I did try setting the ray length to like 500 but still nothing showed. Also tried setting so it excluded the player via layer cuz I thought it was hitting some collider.

Any ideas?

Edit: I am using Debug.DrawRay

Raycasts don’t ‘show’ unless you draw them yourself.
Unity - Scripting API: Debug.DrawRay (unity3d.com)

I did that. And I cant see them unless I fire them from specific point. The fingers of the right hand.

Are you sure you’re actually calling the code? Is there an if-statement that could be failing anywhere, preventing you from raycasting in the first place?

Quite positive. Cuz when I place it on the fingers, it does draw the line. When I place it anywhere else, I see no line. I will double check the code. But here is the code so you can see yourself.

https://hatebin.com/hensoqpesn

The layermask on Physics.Raycast is for which layers to INCLUDE, not exclude.
Could it be hitting the player itself?

You’re only drawing the ray when it hits something. So presumably it’s not hitting anything when it’s not being drawn.

You were correct indeed. Taking it out the brackets it showed just fine.

This was not the case, the problem was I was drawing the ray only if it hit something.