onTouchMoved Issue

Hello,

Do you a easy to find the direction of a touch with “onTouchMoved” function ? Like for to know, if the direction is up, down, left or right.

In advance thanks,

The touch object you get for onTouchMoved, i.e.

void MyClass::onTouchMoved(Touch* touch, Event* event){ ... }

has the function getDelta, i.e. touch->getDelta(). This gives you a vector with how far the touch moved since it moved last along the x axis and the y axis. For example, if touch->getDelta().x is greater than 0, the touch is moving right.

1 Like