docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method Raycast

    Raycast(IUsesSceneRaycast, Ray, out RaycastHit, out GameObject, float, List<GameObject>)

    Do a raycast against all Renderers

    Declaration
    public static bool Raycast(this IUsesSceneRaycast user, Ray ray, out RaycastHit hit, out GameObject go, float maxDistance = Infinity, List<GameObject> ignoreList = null)
    Parameters
    Type Name Description
    IUsesSceneRaycast user

    The functionality user

    Ray ray

    The ray to use for the raycast

    RaycastHit hit

    Hit information

    GameObject go

    The GameObject which was hit, if any

    float maxDistance

    The maximum distance of the raycast

    List<GameObject> ignoreList

    (optional) A list of Renderers to ignore

    Returns
    Type Description
    bool

    Whether the raycast hit a renderer

    In This Article
    Back to top
    Copyright © 2024 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)