docs.unity3d.com
    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
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023