- Home /
 
Iphone touch not working
Hi. am implementing touch on some moving balloons. All moving in same direction but at different position. Once they cross certain height i want enable touch. using following script.
     foreach (Touch touch in Input.touches) {
             
             if (touch.phase == TouchPhase.Began) {
                     Ray ray = Camera.main.ScreenPointToRay(touch.position);
                     RaycastHit hit ;
                    if (Physics.Raycast (ray, out hit)) {
                                             
                      if(transform.position.y > 100) {
         
                                                        /* Instantiate some animation on touch */
                                                         Destroy(gameObject);
     
                         }
                        }
                 }
               }
 
               As i am applying this script on every moving balloons result is not as i want; any help will be highly appreciate.
               Comment
              
 
               
              Your answer