- Home /
Using raycast to check if object is on/off screen
Hi, I just can't make script that will check if camera is looking at the object. Script below only check if camera is directly looking at object, but I need to check if object is on camera(not behind).
var hit: RaycastHit;
 if(Physics.Raycast(cam.transform.position,cam.transform.forward,hit, distance))
 
     {
 
         if (hit.collider.gameObject.tag == "Player")
 
             {
             // Do something
 }
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                