- Home /
 
Gradually decrease camera pan speed when touch has ended? (Touch input)
I want the camera pan to slowly decrease speed when TouchPhase.Ended, instead of the camera pan stopping instantly when finger is released from screen.
Here's where I'm stuck:
 void DecreaseSpeedOnEnded()
     {
         endedPos = new Vector2(transform.position.x, transform.position.y);
         if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)
         {
             //speedDecrease = Mathf.Lerp()
             //transform.position = Vector2.Lerp(endedPos, endedPos, ratio - speedDecrease)
             /*if (ratio <= 0f)
             {
                 //stop moving
             }
             */
             Debug.Log("touch ended");
         }
     }
 
              
               Comment
              
 
               
              Your answer