PDA

View Full Version : Touch/Swipe Size



gintasdx
20-06-2017, 01:58 PM
I wonder how to calculate pixels of swipe length using ZenGL?

The game would apply force based on the touch size line. I would like to calculate that line from touch start to the touch end and get the pixels size value.

Ñuño Martínez
21-06-2017, 10:03 AM
Use simple vector maths:


X := StartP.x - EndP.x;
Y := StartP.y - EndP.y;
Strength := SQR ((x*x) + (y*y));