docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct DistanceInfo

    Struct used to get information back from a distance calculation between an object and a location.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.Interaction.Toolkit.Interactables
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    [MovedFrom("UnityEngine.XR.Interaction.Toolkit")]
    public struct DistanceInfo

    Properties

    collider

    The collider associated with the point. Returns null if the distance calculation doesn't involve colliders, or if there is no valid collider for calculation.

    Declaration
    public Collider collider { readonly get; set; }
    Property Value
    Type Description
    Collider
    See Also
    GetDistance(Vector3)
    TryGetClosestCollider(IXRInteractable, Vector3, out DistanceInfo)
    TryGetClosestPointOnCollider(IXRInteractable, Vector3, out DistanceInfo)

    distanceSqr

    The distance squared between point and the location used for calculation.

    Declaration
    public float distanceSqr { readonly get; set; }
    Property Value
    Type Description
    float
    See Also
    GetDistance(Vector3)
    TryGetClosestCollider(IXRInteractable, Vector3, out DistanceInfo)
    TryGetClosestPointOnCollider(IXRInteractable, Vector3, out DistanceInfo)

    point

    The location on the object (in world space) where the distance was calculated from.

    Declaration
    public Vector3 point { readonly get; set; }
    Property Value
    Type Description
    Vector3
    Remarks

    When used with the method TryGetClosestPointOnCollider(IXRInteractable, Vector3, out DistanceInfo), point contains the collider's position.

    When used with the method TryGetClosestCollider(IXRInteractable, Vector3, out DistanceInfo), this property contains the point on the collider closest to the location used for calculation.

    See Also
    GetDistance(Vector3)
    TryGetClosestCollider(IXRInteractable, Vector3, out DistanceInfo)
    TryGetClosestPointOnCollider(IXRInteractable, Vector3, out DistanceInfo)

    See Also

    GetDistance(Vector3)
    TryGetClosestCollider(IXRInteractable, Vector3, out DistanceInfo)
    TryGetClosestPointOnCollider(IXRInteractable, Vector3, out DistanceInfo)
    In This Article
    Back to top
    Copyright © 2025 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)