So I got a math issue, I have a cube in my scene that I want a static camera to focus on.
The cube should always be fully visible, no matter what viewport Size or scale it starts off with.
I have the Viewport Size/Scale and I also have the cubes Origin, Extent and VectorLength values,
but I can’t for the life of me figure out the formula. (trying to change camera Z-Axis or potentially FoV)
It’s for Mobiles & iPads so the goal is to handle square viewports of iPads and horizontal ones from mobiles!
Example sizes range from 2049x1536 to as small as 1280x720 with a lot of variations in between.
Also, the Constrain Aspect Ratio is set to false, as I don’t want to have black borders, and thus here we are!