# How to scale a plane & fit it screen..?

Get the screensize (width & height), and i want to fit my plane on screen.

At any given distance from the camera, you can calculate the size of a plane to fill the camera by:

``````var height = 2.0 * Mathf.Tan(0.5 * Camera.main.fieldOfView * Mathf.Deg2Rad) * distance;
var width = height * Screen.width / Screen.height;
``````

But if you are just trying to resize a plane for different resolutions, size the plane in the editor so that the height fits then do the second line of the calculation above to get the width in a script.

Thanks a lot, small typo:

``````var height = 2.0 * Mathf.Tan(0.5 * Camera.main.fieldOfView * Mathf.Deg2Rad) * distance;
var width = height * Screen.height / Screen.width;
``````

Should be:

``````var height = 2.0 * Mathf.Tan(0.5 * Camera.main.fieldOfView * Mathf.Deg2Rad) * distance;
var width = height * Screen.width / Screen.height;
``````

ATTENTION:

If you try the correct, simplified formulas

`````` var height = 2.0 * Mathf.Tan(0.5 * Camera.main.fieldOfView * Mathf.Deg2Rad) * distance;
var width = height * Camera.main.aspect;
``````

with Unity planes consider, that a plane in Unity with the scale 1 is actually 10 units in size (wtf?!), in contrast to every other basic primitive (cube, sphere, etcâ€¦).

It took me 6 hours to find out, why i had to divide the height by 10 to match the screen.