#screen to would point not accurate
1 messages · Page 1 of 1 (latest)
through debuging i am quite sure it is because of the screen to world point
lineEnd = Camera.main.ScreenToWorldPoint(Input.mousePosition);
it is in 2D btw
Remember that mouse position gives you a z value of wherever the camera is. If you want an accurate point relative to the world rather than the camera, store the mouse position in a vector, then change that vectors Z position to the depth everything else is at
That should get you a more accurate point in the world
would this fix it?
lineEnd = new Vector3(lineEnd.x, lineEnd.y, 0);
if everything else was also at z = 0
You want to set the z to zero before passing it into screen point to world point
oh ok
The result should also end up with a z of 0, but it'll also make the x and y more accurate to the real position of everything
I tried this and it doesnt work:
Vector3 mousePos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0);
lineEnd = Camera.main.ScreenToWorldPoint(mousePos);
hello?
are you still there?
Sorry, my power went out for a bit. What is it that you're seeing with the line renderer? Can you send a screenshot of where it is vs where you expect it to be?