Differentiating between fingers in multitouch

Sorry if the question title was vague/misleading/confusing, but I didn’t know how else to write it. Say I have two fingers touching the screen, if one is pressing and holding, and the other is swiping, how can I determine which finger is doing which? As in, which one is Input.GetTouch(0), and which is Input.GetTouch(1)? Is there a way to figure it out so I can do both actions at once? That way if one finger is pressing and holding (say to continuously fire a weapon), and then another one goes to swipe (to rotate the camera), I’d be able to do both without confusing the script. And then if the one that is firing the weapon slides a bit, it would keep firing and wouldn’t affect the rotation of the camera. All ideas welcome. Thanks.

A cheap method is to start out by remembering “touch[0] is doing this” and “touch[1] is doing that.” I’ve noticed the touches are stable on a iPad. In other words, if you touch with thumb then pinky, pinky will always be touch[1].

The tricky part is, if they let go of the first finger, the second finger drops down to be touch[0]. So, if you have two touches and touch[0] ends (which you can check,) copy your saved second finger status into first finger.

If some smart guy touches three times and releases #0, bad things might happen. May have to add “if touches more than 2, ignore all until touches drops down to 0.”

Another way, more heavy-duty, is to use the touchID. It’s assigned on touchBegin and will never change over the touch. But, an iPad at least, will reuse the lowest free one (I think.) Exs:

tap and hold 1st finger: touch[0] has ID 0
tap and hold 2nd finger: touch[1] has ID 1
Release 1st finger: 2nd finger is now touch[0], but still has ID 1

Release all fingers, touch again: touch[0] has ID 0 (reuses IDs)

You can “track” any touch, even though it may drop down from [2] to [1] to [0] (I’ve never seen one go up) by the ID.