title: unity3d move by touching
body: <p>I'm going to create Android app where I move gameObject on X and Z cords by touching,gameObject have to move right, left, up or down.  I have written this script which belongs to gameObject where I check the touching by Raycast. </p>
  
  <p>Do you know of any another method to move Object by touching ? </p>
  
  <pre><code>#pragma strict
  
  var hit = new RaycastHit(); 
  
  function Start () {
  }   
  
  function FixedUpdate () {
  
  for (var i :int = 0; i &lt; Input.touchCount; ++i) {
  
      if (Input.GetTouch(0).phase == TouchPhase.Moved ) {
  
          var touchDeltaPosition:Vector2 = Input.GetTouch(i).deltaPosition; 
          var touch_pos : Vector3 = new Vector3(Input.GetTouch(i).position.x, Input.GetTouch(i).position.y , 0);
          var ray : Ray = Camera.main.ScreenPointToRay (touch_pos);
  
  
          Debug.DrawRay (ray.origin, ray.direction * 10, Color.yellow);
  
          if (Physics.Raycast (ray, hit)) 
          {
              Debug.Log(hit.transform.tag);
  
              if(hit.transform.tag == "Cubes")
              {
                  if(Mathf.Abs(Input.GetTouch(i).deltaPosition.x) &gt; Mathf.Abs(Input.GetTouch(i).deltaPosition.y))
                  {
                      if(Input.GetTouch(i).deltaPosition.x &gt; 0)
                      {
                          transform.Translate(0,0,1);
                          // 'right';
                      }
                      else
                      {
                          transform.Translate(0,0,-1);
                          //GUItest.text = 'left';
                      }
                  }
                  else
                  {
                      if(Input.GetTouch(i).deltaPosition.y &gt; 0)
                      {
                          transform.Translate(-1,0,0);
                          // 'up';
                      }
                      else
                      {
                          transform.Translate(1,0,0);
                          // 'dawn';
                      }
                  }
              }
  
          } 
      }
  } 
  </code></pre>
  
  <p>}</p>