Created
October 8, 2020 01:22
-
-
Save GeorgiyRyaposov/e75a3cf109d08d89b2b87682b05cb533 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Bounds OrthographicBounds(float orthographicSize) | |
{ | |
float screenAspect = (float)Screen.width / (float)Screen.height; | |
float cameraHeight = orthographicSize * 2; | |
Bounds bounds = new Bounds( | |
transform.position, | |
new Vector3(cameraHeight * screenAspect, cameraHeight, 0)); | |
return bounds; | |
} | |
private float BoundsToOrthographic(Bounds bounds) | |
{ | |
float screenAspect = (float)Screen.width / (float)Screen.height; | |
return bounds.size.x / screenAspect * 0.5f; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment