title: Unity3D - 2D object rotation based on touch moved (diff between touches)
body: <p>I´m newbie in Unity. I want rotate my 2D object based on user touch moved (moved finger on the screen). I have this code:</p>
  
  <pre><code>void Update ()
  {
      if (Input.touches.Length &gt; 0) {
           t = Input.GetTouch (0);
  
          if (t.phase == TouchPhase.Moved) {
              Vector3 movePos = new Vector3 (t.position.x, t.position.y, 0);
              var objectPos = Camera.main.WorldToScreenPoint (transform.position);
              var dir = movePos - objectPos; 
              transform.rotation = Quaternion.Euler (new Vector3 (0f, 0f, Mathf.Atan2 (dir.y, dir.x) * Mathf.Rad2Deg));
          }
      }
  }
  </code></pre>
  
  <p>This code rotate the object based on user touch but when I touch screen again in another position and do touch move, it will rotate the whole object to the actual touch and then it will do correct object rotation based on touch move.</p>
  
  <p>And I dont´t want rotate the whole object based on touch position but rotate the object only based on touch move. Do you understand me? Can you help me? How should I rewrite my code?</p>