Hi, I am doing a swipe function for a football game. How do I get the following items?
StartSwipeTime
EndSwipeTime
StartSwipePoint/Coordinate
EndSwipePoint/Coordinate
I have the direction of the swipe → gesture.swipeVector.normalized.
What is the function to move the object based on speed of swipe, length of swipe and direction of swipe?
I found my answers, here’s the code for reference. Note: I’m using Easytouch.
void On_DragStart(Gesture gesture){
// Verification that the action on the object
if (gesture.pickObject == gameObject){
position = gesture.GetTouchToWordlPoint(13);
}
dragStartPos = position;
dragTimeBegin = Time.time;
} //same with On_DragEnd.
Then Vector3.Distance (a,b) to get the distance and endTime - startTime to get the time