Class XRRaycastSubsystem
Base class for a raycast subsystem.
Namespace: UnityEngine.XR.ARSubsystems
Syntax
public abstract class XRRaycastSubsystem : Subsystem<XRRaycastSubsystemDescriptor>
Remarks
This abstract class should be implemented by an XR provider and instantiated using the SubsystemManager
to enumerate the available XRRaycastSubsystemDescriptors.
Constructors
XRRaycastSubsystem()
Constructor. Do not invoke directly; use the SubsystemManager
to enumerate the available XRRaycastSubsystemDescriptors
and call Create
on the desired descriptor.
Declaration
public XRRaycastSubsystem()
Fields
m_Running
Implementing classes must set this value to reflect the running state of the subsystem
Declaration
protected bool m_Running
Field Value
Type | Description |
---|---|
Boolean |
Properties
running
Whether the subsystem is currently running.
Declaration
public bool running { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
CreateProvider()
Should return an instance of XRRaycastSubsystem.IProvider.
Declaration
protected abstract XRRaycastSubsystem.IProvider CreateProvider()
Returns
Type | Description |
---|---|
XRRaycastSubsystem.IProvider | The interface to the implementation-specific provider. |
Destroy()
Destroys the subsystem.
Declaration
public override sealed void Destroy()
Raycast(Ray, TrackableType, Allocator)
Casts ray
against trackables specified with trackableTypeMask
.
Declaration
public NativeArray<XRRaycastHit> Raycast(Ray ray, TrackableType trackableTypeMask, Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Ray | ray | A ray in session space. |
TrackableType | trackableTypeMask | The types of trackables to test for ray intersections. |
Allocator | allocator | The |
Returns
Type | Description |
---|---|
NativeArray<XRRaycastHit> | A |
Raycast(Vector2, TrackableType, Allocator)
Casts a ray originating from screenPoint
against trackables specified with trackableTypeMask
.
Declaration
public NativeArray<XRRaycastHit> Raycast(Vector2 screenPoint, TrackableType trackableTypeMask, Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | screenPoint | A point on the screen in normalized screen coordinates (0, 0) - (1, 1) |
TrackableType | trackableTypeMask | The types of trackables to test for ray intersections. |
Allocator | allocator | The |
Returns
Type | Description |
---|---|
NativeArray<XRRaycastHit> | A |
Start()
Starts the subsystem.
Declaration
public override void Start()
Stop()
Stops the subsystem.
Declaration
public override void Stop()