docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Method TryGetCurrent3DRaycastHit

    TryGetCurrent3DRaycastHit(out RaycastHit)

    Gets the first 3D ray cast hit, if any ray cast hits are available.

    Declaration
    public bool TryGetCurrent3DRaycastHit(out RaycastHit raycastHit)
    Parameters
    Type Name Description
    RaycastHit raycastHit

    When this method returns, contains the ray cast hit if available; otherwise, the default value.

    Returns
    Type Description
    bool

    Returns true if a hit occurred, implying the ray cast hit information is valid. Otherwise, returns false.

    TryGetCurrent3DRaycastHit(out RaycastHit, out int)

    Gets the first 3D ray cast hit, if any ray cast hits are available.

    Declaration
    public bool TryGetCurrent3DRaycastHit(out RaycastHit raycastHit, out int raycastEndpointIndex)
    Parameters
    Type Name Description
    RaycastHit raycastHit

    When this method returns, contains the ray cast hit if available; otherwise, the default value.

    int raycastEndpointIndex

    When this method returns, contains the index of the sample endpoint if a hit occurred. Otherwise, a value of 0 if no hit occurred.

    Returns
    Type Description
    bool

    Returns true if a hit occurred, implying the ray cast hit information is valid. Otherwise, returns false.

    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)