How to make your object follow your touch position faster or instantaneously???

In my 2D game, the object doesn’t instantly catch up to where my finger is. Yes, it makes it follow my touch much smoother while moving, but I want it to be instant, I want my 2D object to be instantly on where my finger is…

I also lose control of my object since when it gets late behind following my finger, my finger is no longer touching the collider, and I also want it to be able to only move and follow my finger when I’m touching its collider.

Here’s the code I’m using right now. It follows my finger smoothly, but it can’t catch up to my touch position to the point where I’m no longer touching its box collider:

if(Physics.Raycast(ray, Mathf.Infinity, playerLayerMask))
	{

		transform.position = Camera.main.ScreenToWorldPoint
		(new Vector3(Input.GetTouch(i).position.x, Input.GetTouch(i).position.y, 9)); 

	}

Try to do this in LateUpdate()

Another solution is to introduce another variable

Vector3 lastTouch;

void LateUpdate(){
  if(Input.touches>0)
  {
    lastTouch = Camera.main.ScreenToWorldPoint(new Vector3(Input.GetTouch(i).position.x, Input.GetTouch(i).position.y, 9));
  }
    transform.position = lastTouch;    
}

Rather than continuously checking wether or not you are touching the object, you should set a boolean to true, similar to this:

if (Input.GetMouseButtonDown(0)) 
{
     if(Physics.Raycast(ray, Mathf.Infinity, playerLayerMask))
     {
           dragging = true;
     }
}

and then set dragging to false when you release the mouse. (Input.GetMouseButtonUp(0))

While dragging, have the object follow your mouse as you did in your code.

Note - in case you’re wondering, this also works for mobile touch.