Unity Community


Results 1 to 2 of 2

  1. Posts
    142

    touch.deltaPosition not working?

    Eeer...forget about that, my bad, i used
    Code:  
    1. val_x = Input.GetTouch(0).position.x;
    instead of
    Code:  


    Hi, i'm having a strange problem with the touch.deltaPosition.

    Instead of giving me the deltaPosition of the touch, it's giving me the same as touch.position.

    Is this known or is my code?

    My code is based in the one found in the help, here it is:

    Code:  
    1. var tex_x : GUIText;
    2. var tex_y : GUIText;
    3. var infoin : GUIText;
    4. var infonum:int = 0;
    5.  
    6. var val_x:int ;
    7. var val_y:int ;
    8.  
    9.  
    10. function Update () {
    11.     if (Input.GetTouch(0).phase == TouchPhase.Began) {
    12.         infonum = infonum + 1;
    13.         infoin.text = ""+infonum.ToString("f2");   
    14.     }
    15.     if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) {
    16.         var touchDeltaPosition:Vector2 = Input.GetTouch(0).deltaPosition;
    17.         val_x = Input.GetTouch(0).position.x;
    18.         val_y = Input.GetTouch(0).position.y;
    19.         tex_x.text = "" + val_x.ToString("f2");
    20.         tex_y.text ="" + val_y.ToString("f2");
    21.     }
    22. }

    I'm using three GUIText to see the changes in the screen.

    Some idea?

    Thanks.
    Last edited by Juan; 02-07-2011 at 07:25 AM.


  2. Location
    Zürich, Switzerland
    Posts
    26,572
    likely a workaround to make multitouch usable on android at all.
    Until very recently (not sure how recently, but HTC Desire for example suffers from anomalies on touch 2+ too) the multitouch implementation on android devices was limited and/or broken, leading to problems on touch 2+ handling that end with jumping around stuff and alike.

    As such its not really safe to track too much on this end, EA and others omited multitouch whereever possible (sims 3 has multitouch on every platform aside android for example) to support more than Q4 2010 released android devices.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •