Object following mouse touch on distance


My Code:

if(Input.touchCount > 0)
            Touch touch = Input.GetTouch(0);
            Vector3 touchPosition = Camera.main.ScreenToWorldPoint(touch.position);
            offset = touchPosition - transform.position;
            offset.z = 0;
            transform.position = touchPosition + offset;


So… I have the Problem that my object is jumping between the touchPosition. Why and how to fix that?

You want to move your object smoothly towards your touch position? You can use Vector3.MoveTowards function to do that.