docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class XRRayInteractor.RaycastHitComparer

    Compares ray cast hits by distance, to sort in ascending order.

    Inheritance
    object
    XRRayInteractor.RaycastHitComparer
    Implements
    IComparer<RaycastHit>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.XR.Interaction.Toolkit.Interactors
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    protected sealed class XRRayInteractor.RaycastHitComparer : IComparer<RaycastHit>

    Methods

    Compare(RaycastHit, RaycastHit)

    Compares ray cast hits by distance in ascending order.

    Declaration
    public int Compare(RaycastHit a, RaycastHit b)
    Parameters
    Type Name Description
    RaycastHit a

    The first ray cast hit to compare.

    RaycastHit b

    The second ray cast hit to compare.

    Returns
    Type Description
    int

    Returns less than 0 if a is closer than b. 0 if a and b are equal. Greater than 0 if b is closer than a.

    Implements

    IComparer<T>
    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)