# How can I get the speed of finger drag using unity TouchPhase.Moved?

I’m making a mobile game where you control a 3d ball by touch. So far I can get it to roll based on finger down and drag (via TouchPhase.Moved) but I want to be able to detect a fast flick or finger swipe so that I can addforce based on finger speed and let go. Bit like how I would if I was only using TouchPhase.Began and TouchPhase.Ended with calculating start/end position and time duration, but now I think I need to do something in .Moved to keep track of finger speed and get the start and end position of the beginning and end of that fast finger movement. Here’s my code so far:

``if (Input.touchCount > 0)       {           touch = Input.GetTouch(0);            if (touch.phase == TouchPhase.Began)           {               touchdown = true;           }            if (touch.phase == TouchPhase.Moved)           {               if (touchdown == true)               {                   startPos = new Vector2(0, 0);               }               else {                   startPos = Input.GetTouch(0).position;               }                              touchTimeStart = Time.time;                direction = startPos - endPos;               timeInterval = touchTimeFinish - touchTimeStart;                endPos = Input.GetTouch(0).position;               touchTimeFinish = Time.time;                              rb.AddForce(direction.x * force, 0, direction.y * force/ moveSpeed);                touchdown1 = false;            } if (touch.phase == TouchPhase.Ended)       {           startPos = new Vector2(0, 0);           endPos = new Vector2(0, 0); } } ``