- Home /
Question by
feneq · Oct 02, 2015 at 03:13 AM ·
touch controlsmouse movement
1 to 1 mouse or touch movement, is it possible?
Is it possible to have an object stick to the mouse or touch position? Here is some sample code
void Update()
{
if(Input.GetMouseButton(0))
{
Vector2 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
this.transform.position = pos;
}
}
The object follows the mouse/touch position accurately but it lags behind the cursor/touch. Is this a limitation? I would appreciate any ideas.
Thanks!
Comment