So with the mouse move function you can get a variable dx/dy which measures the distance of the last few mouse positions (at least that’s what I assume)
There is no dx/dy that I can see for a touch move and was curious what way I could get the same results that you’d get from the mouse move.
I tried this idea in pseudo code:
var firstPositionX = 0;
var lastPositionX = 0;
var hasXpositionChanged = false;
if(hasXpositionChanged){
firstPositionX = touch.x;
hasXpositionChanged = false;
} else {
lastPositionX = firstPositionX;
hasXpositionChanged = true;
}
var distanceX = firstPositionX - lastPositionX;
My code could be broke but it would show a varying amount of distance created, but it doesn’t seem to be the right fit. Not sure why.