Skip to content

Instantly share code, notes, and snippets.

@coastwise
Created July 8, 2013 18:33
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save coastwise/5951291 to your computer and use it in GitHub Desktop.
Save coastwise/5951291 to your computer and use it in GitHub Desktop.
Compute horizontal field of view in Unity
float vFOVInRads = Camera.main.fieldOfView * Mathf.Deg2Rad;
float hFOVInRads = 2 * Mathf.Atan( Mathf.Tan(vFOVInRads / 2) * Camera.main.aspect);
float hFOV = hFOVInRads * Mathf.Rad2Deg;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment