I have a Raycast whose purpose is to check if the player is looking at an in-game computer screen. This is the code:
`public LayerMask mask1;
Ray screenTest = new Ray (transform.position, transform.forward);
RaycastHit hitInfo;
if (Physics.Raycast(screenTest,out hitInfo, mask1)) {
Debug.DrawLine(screenTest.origin, hitInfo.point,Color.blue);
}
else {Debug.DrawLine (screenTest.origin,screenTest.origin + screenTest.direction * 25 , Color.green);}`
I have assigned the In-game screen a layer of “screen” and set the mask of the camera the script is on to screen in the inspector, yet the Raycast is printing that Everything is the “screen”, the walls floors and such. I’ve looked around and have not been able to get a precise answer to my problem.