I am experiencing a problem with the positioning of multi touches. In two consecutive calls to Update, the actual position on both axis remained the same for a particular touch, however a non-zero value was reported in the deltaPosition for that axis. Am I attempting to read deltaPositions for touch phases that don’t support them perhaps?
My code and debug follows:
Code
void Update (){
foreach (Touch touch in Input.touches) {
if (touch.phase == TouchPhase.Stationary){
continue;
}
if (touch.phase != TouchPhase.Began){
float previousX = touch.position.x - touch.deltaPosition.x;
float previousY = touch.position.y - touch.deltaPosition.y;
Debug.Log("Touch No:" + touch.fingerId);
Debug.Log("Touch PosX:" + touch.position.x + " - Delta PosX:" + touch.deltaPosition.x + " = " + previousX + " ||| Touch PosY:" + touch.position.y + " - Delta PosY:" + touch.deltaPosition.y + " = " + previousY);
}
}
}
Below is the debug that is output from the above code.
Touch No:0
Touch PosX:1272 - Delta PosX:12 = 1260 ||| Touch PosY:227 - Delta PosY:30 = 197
Touch No:1
Touch PosX:1264 - Delta PosX:19 = 1245 ||| Touch PosY:365 - Delta PosY:-99 = 464
Touch No:0
Touch PosX:1267 - Delta PosX:-5 = 1272 ||| Touch PosY:291 - Delta PosY:64.00003 = 227
Touch No:1
Touch PosX:1264 - Delta PosX:2 = 1262 ||| Touch PosY:365 - Delta PosY:-5.000061 = 370