Hello, I’m using Unity Personal to develop a simple 2D game.
I made a Scene with just an Othographic Camera and one object with a single script to illustrate the problem:
void Update () {
Vector3 target = Camera.main.ScreenToWorldPoint(Input.mousePosition);
target.z = 0;
transform.position = target;
}
This script will make the object follow the mouse.
The “target.z = 0” part is because the camera is looking up the z axis and I want the object to stay on the z=0 plane.
Problem: moving the mouse fast enough results in an offset between it and the object.
My game is touch and I don’t like the collider area getting away from the finger.
What is the cause?
If the Update frequency is too low, is there a way I can increase it?
If not, what can I do about it?
Thanks.