Class CameraExtensions
Extension methods for the Unity's Camera class
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit
Assembly: cs.temp.dll.dll
Syntax
public static class CameraExtensions
Methods
GetDistanceForFrustumHeight(Camera, Single)
Gets the distance to the camera that a specific frustum height would be at.
Declaration
public static float GetDistanceForFrustumHeight(this Camera camera, float frustumHeight)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera | The camera to get the distance from |
| Single | frustumHeight | The frustum height |
Returns
| Type | Description |
|---|---|
| Single |
GetFrustumSizeForDistance(Camera, Single)
Gets the frustum size at a given distance from the camera.
Declaration
public static Vector2 GetFrustumSizeForDistance(this Camera camera, float distanceFromCamera)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera | The camera to get the frustum size for |
| Single | distanceFromCamera | The distance from the camera to get the frustum size at |
Returns
| Type | Description |
|---|---|
| Vector2 |
GetHorizontalFieldOfViewDegrees(Camera)
Get the horizontal FOV from the stereo camera in degrees
Declaration
public static float GetHorizontalFieldOfViewDegrees(this Camera camera)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera |
Returns
| Type | Description |
|---|---|
| Single |
GetHorizontalFieldOfViewRadians(Camera)
Get the horizontal FOV from the stereo camera in radians
Declaration
public static float GetHorizontalFieldOfViewRadians(this Camera camera)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera |
Returns
| Type | Description |
|---|---|
| Single |
IsInFOV(Camera, Vector3)
Returns if a point will be rendered on the screen in either eye
Declaration
public static bool IsInFOV(this Camera camera, Vector3 position)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera | The camera to check the point against |
| Vector3 | position |
Returns
| Type | Description |
|---|---|
| Boolean |
IsInFOVCone(Camera, Vector3, Single)
Returns true if a point is in the a cone inscribed into the Camera's frustum, false otherwise The cone is inscribed to a radius equal to the vertical height of the camera's FOV. By default, the cone's tip is "chopped off" by an amount defined by the camera's far and near clip planes.
Declaration
public static bool IsInFOVCone(this Camera camera, Vector3 point, float coneAngleBufferDegrees = 0F)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera | |
| Vector3 | point | Point to test |
| Single | coneAngleBufferDegrees | Degrees to expand the cone radius by. |
Returns
| Type | Description |
|---|---|
| Boolean |