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
Inherited Members
Namespace: UnityEngine.XR.ARFoundation
Syntax
[DisallowMultipleComponent]
[RequireComponent(typeof(ARSessionOrigin))]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@3.0/api/UnityEngine.XR.ARFoundation.ARRaycastManager.html")]
public sealed class ARRaycastManager : SubsystemLifecycleManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor>
Methods
OnAfterStart()
Declaration
protected override void OnAfterStart()
Overrides
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 = null)
Parameters
Type | Name | Description |
---|---|---|
Ray | ray | The |
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 |
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 = null)
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 |