Class ARRaycast
Represents a raycast that updates automatically.
Inheritance
Inherited Members
Namespace: UnityEngine.XR.ARFoundation
Syntax
[DefaultExecutionOrder(-2147483646)]
[DisallowMultipleComponent]
[HelpURL("https://docs.unity.cn/Packages/com.unity.xr.arfoundation@4.1/api/UnityEngine.XR.ARFoundation.ARRaycast.html")]
public sealed class ARRaycast : ARTrackable<XRRaycast, ARRaycast>
Remarks
Generated by the ARRaycastManager. Create a raycast with AddRaycast(Vector2, Single).
Properties
distance
The distance, in meters, between the raycast's origin and intersection point.
Declaration
public float distance { get; }
Property Value
Type | Description |
---|---|
Single |
nativePtr
Get a native pointer associated with this raycast.
Declaration
public IntPtr nativePtr { get; }
Property Value
Type | Description |
---|---|
IntPtr |
Remarks
The data pointed to by this member is implementation defined. The lifetime of the pointed to object is also implementation defined, but should be valid at least until the next ARSession update.
plane
The ARPlane hit by the raycast, or null
if the raycast does not intersect a plane.
Declaration
public ARPlane plane { get; }
Property Value
Type | Description |
---|---|
ARPlane |
Methods
OnAfterSetSessionRelativeData()
Marks this raycast as updated, causing the updated event to be invoked during the Update callback.
Declaration
protected override void OnAfterSetSessionRelativeData()
Overrides
Events
updated
Invoked whenever this raycast is updated. The event is fired during this MonoBehaviour
's
Update callback. This event is not
invoked if this component is disabled,
although it may continue to receive positional updates.
Declaration
public event Action<ARRaycastUpdatedEventArgs> updated
Event Type
Type | Description |
---|---|
Action<ARRaycastUpdatedEventArgs> |