Class CameraExtensions
Extension methods for Camera components
Inherited Members
Namespace: Unity.XR.CoreUtils
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 |
---|---|
Single | The horizontal field of view of the camera |
GetVerticalFieldOfView(Camera, Single)
Calculates the vertical field of view from an aspect neutral (diagonal) field of view and the camera's aspect ratio. Unity cameras' field of view properties are storing the vertical field of view.
Declaration
public static float GetVerticalFieldOfView(this Camera camera, float aspectNeutralFieldOfView)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | The camera to get the aspect ratio from |
Single | aspectNeutralFieldOfView | The "aspect neutral" field of view, which is the diagonal field of view |
Returns
Type | Description |
---|---|
Single | The vertical field of view calculated |
GetVerticalOrthographicSize(Camera, Single)
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 |
Single | size | The diagonal orthographic size |
Returns
Type | Description |
---|---|
Single | The vertical orthographic size calculated |