- Home /
Question by
LucasPThiago · Aug 05, 2018 at 03:01 AM ·
cameragameobjectpositionvector3screentoworldpoint
How to keep the same position of the object instead of camera
Hi folks ! I'm make a object dragglabe, but i have a problem, my object goes foward instead to keep in the same position. How can i solve this ?
I'm use this code:
Vector3 mousePosition = new Vector3(GameObject.Find("Barr").GetComponent().position.x, Input.mousePosition.y, 2f); Vector3 objPosition = Camera.main.ScreenToWorldPoint(mousePosition); GameObject.Find("Barr").GetComponent(). position = objPosition;
Comment