- Home /
How to stop Raycast from camera to player target through colliders?
 var ray = Camera.main.ScreenPointToRay(Camera.main.WorldToScreenPoint(player.transform.position));
         RaycastHit hit;
         if (Physics.Raycast(ray, out hit)) {
             visible = true;
         } else {
             visible = false;
         }
When i orbit camera down from floor, visible should turn false, because player is not visible anymore. How do i do that?
Thanks
               Comment
              
 
               
              you can check if the collider your raycast hit has the player tag or not using the CompareTag() function
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                