Multitouch! How do I keep track of which fingers?

FogelbergFogelberg Member Posts: 103
edited December 2011 in Working with GS (Mac)
If I do a multitouch - say 3 fingers are touching the screen. I can easily find out how many fingers that are touching and the x,y position of those three fingers. But when the user lifts one finger and only two fingers are touching, how do I know which finger he lifted?

Comments

  • FogelbergFogelberg Member Posts: 103
    No one?
  • applaudmobileapplaudmobile Member Posts: 208
    you have to be creative. because the GS touch x y attributes keeps the position info even when touch is up you have to record the touch positions as they happen into your own x and y game attributes for as many touches as you need (mytouch1x, mytouch1y, mytouch2x etc...). then when a particular touch is lifted you can clear out those atts to 0 or a negative figure, something you can check against.

    Then when touchcount = 2 test the GS touch attributes against your mytouch attributes and see which one of the GS touches doesn't have a corresponding mytouch attributes.

    hope this makes sense. it should work.
  • FogelbergFogelberg Member Posts: 103
    Aha. Smart. I'll try that. Thanks! :)
  • FogelbergFogelberg Member Posts: 103
    Hm I can't get it to work. I think I may be missing some important detail.
    I constrain the three first GS X and Y touch positions to my own x and y attributes, and when touch is released ( a finger is released ) I set all my x and y attributes to -1.
    Then I compare the GS touch X and Y to my x and y attributes (which all are of course set to -1).
    And that doesn't work of course, since thet are all set to -1.
Sign In or Register to comment.