raycast activation by trigger
Hi, there's a code which allow the player casting a raycast because i have plenty's of object that will react by being touches by a ray.
 public float activeDist;
 public GameObject raycast;
 void Start () {
     raycast.SetActive (false);
 }
 void Update () {
     RaycastHit hit;
     if (Cardboard.SDK.Triggered) {
         raycast.SetActive (true); 
         Ray casting = new Ray (transform.position, Vector3.forward);
     
         Debug.DrawRay (transform.position, Vector3.forward * activeDist); 
         ----> raycast.SetActive (false); <--------------------
     }
So then i run the game if i trigger the button, it cast a ray forever so it isn't juste when i push the button and if i use the last line ("raycast.SetActive(false);") i doesn't work at all ! My other objects don't detect that a ray is touching them.
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Trouble Raycasting elements in UI in Oculus 0 Answers
Raycast hit 2 Answers
How do i snap the end point of a Raycast to a certain transform 1 Answer
Raycast detect in object (problem) 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                