Hi, I’am trying to create a 2d gameObject containing a Sprite and a collider to replace the default cursor.
To keep the game object at the cursor position I wrote a script that changes the gameObject positon to the current mousePosition
void Start () {
tr = gameObject.transform;
ZinitPos = 1.0f;
curPos = new Vector3(0.0f, 0.0f, 0.0f);
}
void Update () {
curPos = Input.mousePosition;
curPos.z = 1.0f;
tr.position = Camera.main.ScreenToWorldPoint(curPos);
}
the code is working fine but the game object has some latency, it moves very slower then the cursor.
I know there is some solution some where and a somebody among you smart people :].
thank you for reading and sorry for wasting your time