docs.unity3d.com
    Show / Hide Table of Contents

    Class CardinalUtility

    Utility functions related to Cardinal directions.

    Inheritance
    Object
    CardinalUtility
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.XR.Interaction.Toolkit.Inputs
    Syntax
    public static class CardinalUtility

    Methods

    GetNearestCardinal(Vector2)

    Get the nearest cardinal direction for a given value.

    Declaration
    public static Cardinal GetNearestCardinal(Vector2 value)
    Parameters
    Type Name Description
    Vector2 value

    Input vector, such as from a thumbstick.

    Returns
    Type Description
    Cardinal

    Returns the nearest Cardinal direction.

    Remarks

    Arbitrarily biases towards North and South to disambiguate when angle is exactly equidistant between directions.

    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