docs.unity.cn
    Show / Hide Table of Contents

    Class CameraExtensions

    Extension methods for Camera components

    Inheritance
    Object
    CameraExtensions
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    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

    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on Wednesday, December 21, 2022
    Terms of use