docs.unity3d.com
    Show / Hide Table of Contents

    Class ARRaycastManager

    Manages an XRRaycastSubsystem, exposing raycast functionality in ARFoundation. Use this component to raycast against trackables (i.e., detected features in the physical environment) when they do not have a presence in the Physics world.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    SubsystemLifecycleManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor>
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>
    ARRaycastManager
    Inherited Members
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.trackables
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.SetTrackablesActive(Boolean)
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.sessionOrigin
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.gameObjectName
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.GetPrefab()
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.m_Trackables
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.m_PendingAdds
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.Awake()
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.OnEnable()
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.OnDisable()
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.CanBeAddedToSubsystem(ARRaycast)
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.Update()
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.OnTrackablesChanged(List<ARRaycast>, List<ARRaycast>, List<ARRaycast>)
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.OnCreateTrackable(ARRaycast)
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.OnAfterSetSessionRelativeData(ARRaycast, XRRaycast)
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.CreateTrackableImmediate(XRRaycast)
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.DestroyPendingTrackable(TrackableId)
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>.CreateTrackableFromExisting(ARRaycast, XRRaycast)
    SubsystemLifecycleManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor>.subsystem
    SubsystemLifecycleManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor>.descriptor
    SubsystemLifecycleManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor>.GetActiveSubsystemInstance()
    SubsystemLifecycleManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor>.EnsureSubsystemInstanceSet()
    SubsystemLifecycleManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor>.OnEnable()
    SubsystemLifecycleManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor>.OnDisable()
    SubsystemLifecycleManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor>.OnDestroy()
    SubsystemLifecycleManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor>.OnBeforeStart()
    SubsystemLifecycleManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor>.OnAfterStart()
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(String)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(Object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(String)
    Component.SendMessageUpwards(String, Object, SendMessageOptions)
    Component.SendMessageUpwards(String, Object)
    Component.SendMessageUpwards(String)
    Component.SendMessageUpwards(String, SendMessageOptions)
    Component.SendMessage(String, Object)
    Component.SendMessage(String)
    Component.SendMessage(String, Object, SendMessageOptions)
    Component.SendMessage(String, SendMessageOptions)
    Component.BroadcastMessage(String, Object, SendMessageOptions)
    Component.BroadcastMessage(String, Object)
    Component.BroadcastMessage(String)
    Component.BroadcastMessage(String, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Component.rigidbody
    Component.rigidbody2D
    Component.camera
    Component.light
    Component.animation
    Component.constantForce
    Component.renderer
    Component.audio
    Component.networkView
    Component.collider
    Component.collider2D
    Component.hingeJoint
    Component.particleSystem
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: UnityEngine.XR.ARFoundation
    Syntax
    [DefaultExecutionOrder(-2147483647)]
    [DisallowMultipleComponent]
    [RequireComponent(typeof(ARSessionOrigin))]
    [HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@4.1/api/UnityEngine.XR.ARFoundation.ARRaycastManager.html")]
    public sealed class ARRaycastManager : ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycast, ARRaycast>

    Properties

    gameObjectName

    The name of the GameObject for each instantiated ARRaycast.

    Declaration
    protected override string gameObjectName { get; }
    Property Value
    Type Description
    String
    Overrides
    UnityEngine.XR.ARFoundation.ARTrackableManager<UnityEngine.XR.ARSubsystems.XRRaycastSubsystem, UnityEngine.XR.ARSubsystems.XRRaycastSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRRaycast, UnityEngine.XR.ARFoundation.ARRaycast>.gameObjectName

    raycastPrefab

    If not null, this prefab will be instantiated for each ARRaycast.

    Declaration
    public GameObject raycastPrefab { get; set; }
    Property Value
    Type Description
    GameObject

    Methods

    AddRaycast(Vector2, Single)

    Creates an ARRaycast that updates automatically. ARRaycasts will continue to update until you remove them with RemoveRaycast(ARRaycast) or disable this component.

    Declaration
    public ARRaycast AddRaycast(Vector2 screenPoint, float estimatedDistance)
    Parameters
    Type Name Description
    Vector2 screenPoint

    A point on the screen, in pixels.

    Single estimatedDistance

    The estimated distance to the intersection point. This can be used to determine a potential intersection before the environment has been fully mapped.

    Returns
    Type Description
    ARRaycast

    A new ARRaycast if successful; otherwise null.

    GetPrefab()

    Gets the prefab that should be instantiated for each ARRaycast. May be null.

    Declaration
    protected override GameObject GetPrefab()
    Returns
    Type Description
    GameObject

    The prefab that should be instantiated for each ARRaycast.

    Overrides
    UnityEngine.XR.ARFoundation.ARTrackableManager<UnityEngine.XR.ARSubsystems.XRRaycastSubsystem, UnityEngine.XR.ARSubsystems.XRRaycastSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRRaycast, UnityEngine.XR.ARFoundation.ARRaycast>.GetPrefab()

    OnAfterSetSessionRelativeData(ARRaycast, XRRaycast)

    Invoked just after a ARRaycast has been updated.

    Declaration
    protected override void OnAfterSetSessionRelativeData(ARRaycast raycast, XRRaycast sessionRelativeData)
    Parameters
    Type Name Description
    ARRaycast raycast

    The ARRaycast being updated.

    XRRaycast sessionRelativeData

    The new data associated with the raycast. All spatial data is is session-relative space.

    Overrides
    UnityEngine.XR.ARFoundation.ARTrackableManager<UnityEngine.XR.ARSubsystems.XRRaycastSubsystem, UnityEngine.XR.ARSubsystems.XRRaycastSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRRaycast, UnityEngine.XR.ARFoundation.ARRaycast>.OnAfterSetSessionRelativeData(UnityEngine.XR.ARFoundation.ARRaycast, UnityEngine.XR.ARSubsystems.XRRaycast)

    OnAfterStart()

    Invoked just after the subsystem has been Started. Used to set raycast delegates internally.

    Declaration
    protected override void OnAfterStart()
    Overrides
    UnityEngine.XR.ARFoundation.SubsystemLifecycleManager<UnityEngine.XR.ARSubsystems.XRRaycastSubsystem, UnityEngine.XR.ARSubsystems.XRRaycastSubsystemDescriptor>.OnAfterStart()

    Raycast(Ray, List<ARRaycastHit>, TrackableType)

    Cast a Ray against trackables, i.e., detected features such as planes.

    Declaration
    public bool Raycast(Ray ray, List<ARRaycastHit> hitResults, TrackableType trackableTypes = TrackableType.All)
    Parameters
    Type Name Description
    Ray ray

    The Ray, in Unity world space, to cast.

    List<ARRaycastHit> hitResults

    Contents are replaced with the raycast results, if successful.

    TrackableType trackableTypes

    (Optional) The types of trackables to cast against.

    Returns
    Type Description
    Boolean

    True if the raycast hit a trackable in the trackableTypes

    Raycast(Vector2, List<ARRaycastHit>, TrackableType)

    Cast a ray from a point in screen space against trackables, i.e., detected features such as planes.

    Declaration
    public bool Raycast(Vector2 screenPoint, List<ARRaycastHit> hitResults, TrackableType trackableTypes = TrackableType.All)
    Parameters
    Type Name Description
    Vector2 screenPoint

    The point, in device screen pixels, from which to cast.

    List<ARRaycastHit> hitResults

    Contents are replaced with the raycast results, if successful.

    TrackableType trackableTypes

    (Optional) The types of trackables to cast against.

    Returns
    Type Description
    Boolean

    True if the raycast hit a trackable in the trackableTypes

    RemoveRaycast(ARRaycast)

    Removes an existing ARRaycast.

    Declaration
    public void RemoveRaycast(ARRaycast raycast)
    Parameters
    Type Name Description
    ARRaycast raycast

    The ARRaycast to remove.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown is raycast is null.

    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on Monday, November 7, 2022
    Terms of use