Search Unity

Multi-touch rotation

Discussion in 'Android' started by mythicwave, Jul 11, 2011.

  1. mythicwave

    mythicwave

    Joined:
    Jul 13, 2008
    Posts:
    144
    How would I rotate an object using multi-touch? For example, I have simple irregularly shaped planes that I want to rotate by using two fingers. How would I simulate this on PC or Mac for testing? Would I use two mouse buttons? Would an add-on like EZ GUI help me with this or would it be better or easier to just code it directly in Unity?

    Thanks in advance,

    Brian
     
  2. sawfish

    sawfish

    Joined:
    Feb 12, 2011
    Posts:
    314
    I was using this type of functionality, basically one finger acts as a pivot and the other rotates around it. The problem is, if the person pinches it picks it up as a pinch instead of a twist. The radius has to stay about the same, and it ended up being more trouble than it's worth. I am switching to touch/swipe rotation.
     
  3. mythicwave

    mythicwave

    Joined:
    Jul 13, 2008
    Posts:
    144
    Were you doing this with EZ GUI or directly with Unity code? What about one finger not acting as a pivot, but instead the center between your two fingers is the pivot? What do you mean by touch/swipe rotation?

    Thanks,

    Brian
     
    Last edited: Jul 11, 2011
  4. sawfish

    sawfish

    Joined:
    Feb 12, 2011
    Posts:
    314
    I was using a modified version of the script that comes with the Penelope demo (it has twist rotate).

    It was *supposed* to be a combination of both fingers twisting, but it seemed to work better (with the same code) using one of the fingers as the pivot.

    I mean, you can select an object, and then by dragging a finger left or right on the screen makes the camera rotate around the object.

    I think it is easier math-wise as well, but haven't tried writing the script yet.