[HELP] Swiping multiple objects from a raycast
Hi there I will try to explain this as best as I can. I was working on a Touch Logic script where as to when you touch an object and swipe it a certain way it will go that direction. Now the kicker is that I have multiple objects that are on the screen and every time I swipe "Up" only one object will move up constantly. I think I need a raycast but Im not sure where to put it. I tried in certain locations but I'm still getting the same results. Please help me I appreciate it.
Touch Logic Script:
     public GameObject upWall;
 
     Ray ray;
     RaycastHit hit;
 
     public float maxTime;
     public float minSwipeDist;
 
     float startTime;
     float endTime;
 
     Vector3 startPos;
     Vector3 endPos;
 
     float swipeDistance;
     float swipeTime;
 
     // Use this for initialization
     void Start () {
     
     }
     
     // Update is called once per frame
     void Update () {
 
         if (Input.touchCount > 0) { //(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) {
 
             Touch touch = Input.GetTouch(0);
 
             if (touch.phase == TouchPhase.Began)
             {
 
                 startTime = Time.time;
                 startPos = touch.position;
              
             }
             else if (touch.phase == TouchPhase.Ended ) {
 
                 endTime = Time.time;
                 endPos = touch.position;
 
                 swipeDistance = (endPos - startPos).magnitude;
                 swipeTime = endTime - startTime;
 
                 if (swipeTime < maxTime && swipeDistance > minSwipeDist) {
                     swipe();
                 }
             }
         }
 
     }
 
     void swipe() {
 
         Vector2 distance = endPos - startPos;
         if (Mathf.Abs(distance.x) > Mathf.Abs(distance.y)) {
             Debug.Log("Horizantal Swipe");
 
             if (distance.x > 0) {
                 Debug.Log("Right Swipe");
             }
 
             if (distance.x < 0)
             {
                 Debug.Log("Left Swipe");
             }
 
         }
         else if(Mathf.Abs(distance.x) < Mathf.Abs(distance.y)) {
             Debug.Log("Vertical Swipe");
 
 
             if (distance.y > 0)
             {
                 Debug.Log("Up Swipe");
                 upWall.GetComponent<Upwall>().MovementUp();
             }
 
             if (distance.y < 0)
             {
                 Debug.Log("Down Swipe");
             }
 
         }
 
 
     }
 }
 
This is the movement script of wall moving up:
     public float speed = 100f;
     public float shift = 1f;
 
     public float maxPos = 3.5f;
 
     Vector3 position;
 
     bool currentPlatformAndroid = false;
 
     void Awake() {
           
     }
 
     // Update is called once per frame
     void Start()
     {
         position = transform.position;
 
        
 
     }
 
     void Update()
     {
 
       
 
             float translation = Input.GetAxis("Vertical") * speed * Time.deltaTime;
             position.y = Mathf.Clamp(position.y, 0, 2.4f);
 
             translation *= Time.deltaTime;
             transform.Translate(0, translation, 0);
 
             //transform.position = position;
 
             //(new Vector3(position.x * shift * Time.deltaTime, 0, 0));
             transform.Translate(Vector3.left * shift * Time.deltaTime);
         
     }
 
     public void MovementUp() {
 
         transform.Translate(Vector3.up * 75 * Time.deltaTime);
     }
 }
 
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                