Class CameraExtensions
Extension methods for Camera components.
Inherited Members
Namespace: Unity.XR.CoreUtils
Assembly: Unity.XR.CoreUtils.dll
Syntax
public static class CameraExtensions
Methods
GetHorizontalFieldOfView(Camera)
Calculates the horizontal field of view of the Camera.
Declaration
public static float GetHorizontalFieldOfView(this Camera camera)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | The camera to get the aspect ratio and vertical field of view from. |
Returns
Type | Description |
---|---|
float | The horizontal field of view of the camera. |
GetVerticalFieldOfView(Camera, float)
Calculates the vertical field of view from an aspect neutral (diagonal) field of view and the camera's aspect ratio.
Declaration
public static float GetVerticalFieldOfView(this Camera camera, float aspectNeutralFieldOfView)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | The camera to get the aspect ratio from. |
float | aspectNeutralFieldOfView | The "aspect neutral" field of view, which is the diagonal field of view. |
Returns
Type | Description |
---|---|
float | The vertical field of view calculated. |
Remarks
The field of view property of a Unity Camera stores the vertical field of view.
GetVerticalOrthographicSize(Camera, float)
Calculates the vertical orthographic size for a Camera and a given diagonal size.
Declaration
public static float GetVerticalOrthographicSize(this Camera camera, float size)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | The camera to get the aspect ratio from. |
float | size | The diagonal orthographic size. |
Returns
Type | Description |
---|---|
float | The vertical orthographic size calculated. |