Search Unity

Help, Rotate with two fingers

Discussion in 'iOS and tvOS' started by jeroenx000, Nov 28, 2012.

  1. jeroenx000

    jeroenx000

    Joined:
    Oct 4, 2012
    Posts:
    27
    Code (csharp):
    1. void Rotate()
    2.     {
    3.         Vector3 diff = touchPos[1] - touchPos[0];
    4.         angle = (Mathf.Atan2(diff.y, diff.x));
    5.         transform.rotation = Quaternion.Euler(0f, 0f ,Mathf.Rad2Deg * angle);
    6.     }
    7.  
    how can I make it to only increase/decrease its rotation.
    I only need it on z axis.
     
  2. mtoivo

    mtoivo

    Joined:
    Jul 30, 2012
    Posts:
    274
    I recently used this: DetectTouchMovement

    Works great in my opinion, wasn't that hard to use.
     
    wondermagic likes this.
  3. jeroenx000

    jeroenx000

    Joined:
    Oct 4, 2012
    Posts:
    27
    worked great thanks :eek:
     
  4. abtrakt

    abtrakt

    Joined:
    Jan 8, 2014
    Posts:
    3
    makes my object go crazy on the Z exe