title: How to rotate an object along all 3 axes with finger swipe?
body: <p>I'm working on a simple AR Vuforia application. How can I implement the rotation of an object along all three axes with one finger swipe?</p>
  
  <p>The code I'm currently using has one bug: the rotation of the object depends on its local axes. For example, if I look at the object from the front, everything works as it should, but if I look at the object from the back side, the finger swipe upwards makes it rotate downwards and vice versa.</p>
  
  <p>Here is this script:</p>
  
  <pre><code>public float rotSpeed = 30f;
  
  void OnMouseDrag()
  {
  float rotX = Input.GetAxis("Mouse X")*rotSpeed*Mathf.Deg2Rad;
  float rotY = Input.GetAxis("Mouse Y")*rotSpeed*Mathf.Deg2Rad;
  
  transform.Rotate(Vector3.up, -rotX);
  transform.Rotate(Vector3.right, -rotY);
  } 
  </code></pre>
  
  <p>This is not what I need, how can I rotate the object according to the finger swipe direction regardless of the angle from which I look at it?</p>
  
  <h2>Update</h2>
  
  <p>A simple non-AR example, which may help you understand what I need is an iOS game "Space Frontier 2". After a successful launch of the rocket, it lands on the planet and you can rotate the planet with your finger swipe.   </p>
  
  <p>Here is the video demo: <a href="https://youtu.be/OiNPP1WNIAI" rel="nofollow noreferrer">https://youtu.be/OiNPP1WNIAI</a> </p>