docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Method GetDistance

    GetDistance(Vector3)

    Gets the distance from this Interactable to the given location. This method uses the calculation mode configured in distanceCalculationMode.
    This method can be overridden (without needing to subclass) by assigning a callback to getDistanceOverride. To restore the previous calculation mode configuration, assign null to getDistanceOverride.

    Declaration
    public virtual DistanceInfo GetDistance(Vector3 position)
    Parameters
    Type Name Description
    Vector3 position

    Location in world space to calculate the distance to.

    Returns
    Type Description
    DistanceInfo

    Returns the distance information (in world space) from this Interactable to the given location.

    Remarks

    This method is used by other methods and systems to calculate this Interactable distance to other objects and locations (GetDistanceSqrToInteractor(IXRInteractor)).

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)