- Home /
Question by
Terminator004 · Jan 06, 2020 at 10:15 PM ·
positiony-axismain cameray
How do I get the bottom Y coordinate of the main camera?
I made this:
Vector3 stageDimensions = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0));
Debug.Log(stageDimensions.y);
But it seems it gets top Y coordinate of the main camera, not the bottom. How to get a bottom Y?
Comment
Best Answer
Answer by ShadowLairGames · Jan 06, 2020 at 11:02 PM
Screen coordinates start from bottom left in Unity. The higher the y value, the higher the object is in space.
Vector3 stageDimensions = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0));
Debug.Log(stageDimensions.y);
Should work for you.