1 2 | obj1.transform.position = Camera.main.ViewportToWorldPoint(new Vector2(1, 1)) + new Vector3(0, 0, 10); obj2.transform.position = Camera.main.ViewportToWorldPoint(new Vector2(0, 0)) + new Vector3(0, 0, 10); |
(0,0) is the bottom left corner of the screen in Viewport coordinates.
I add a Vector3 to adjust the Z position.
Camera.main.ViewportToWorldPoint() converts a viewport position into World postion.
If you move the Cam, the position of the corners (pink dots) follows the Cam, if inside Update().
Nenhum comentário:
Postar um comentário