- Home /
 
               Question by 
               psvramaraju · Jun 15, 2016 at 03:21 PM · 
                raycastraycastingraycasthitraycasthit2d  
              
 
              Ray is not being detected
Hello, Actually we are trying to hit an object with a ray. In output it is detecting an object but we cant see the ray. Can someone help us in fixing this/ Here is the code attached: using UnityEngine; using System.Collections;
public class Raycast : MonoBehaviour {
 // Use this for initialization
 void Start()
 {
 }
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hitinfo;
         
        if (Physics.Raycast(ray, out hitinfo, 100f))
         {
             Debug.Log("collission detected" + hitinfo.collider.name);
             Debug.DrawLine(ray.direction, hitinfo.point);
         }
     }
 }
}
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                