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));
}