Struct XRRaycast
Represents the intersection of a raycast with a trackable.
Namespace: UnityEngine.XR.ARSubsystems
Syntax
public struct XRRaycast : ITrackable, IEquatable<XRRaycast>
Constructors
XRRaycast(TrackableId, Pose, TrackingState, IntPtr, Single, TrackableId)
Constructs an XRRaycast.
Declaration
public XRRaycast(TrackableId trackableId, Pose pose, TrackingState trackingState, IntPtr nativePtr, float distance, TrackableId hitTrackableId)
Parameters
| Type | Name | Description | 
|---|---|---|
| TrackableId | trackableId | The TrackableId of the trackable which was hit.  | 
| Pose | pose | The session-space   | 
| TrackingState | trackingState | The tracking state of this raycast.  | 
| IntPtr | nativePtr | A pointer into native memory for this raycast.  | 
| Single | distance | The session-space distance from the raycast origin to the intersection point.  | 
| TrackableId | hitTrackableId | The TrackableId of the trackable hit by this raycast, or invalidId if none.  | 
Properties
defaultValue
A default-initialized raycast. This may be different from a zero-initialized raycast.
Declaration
public static XRRaycast defaultValue { get; }
Property Value
| Type | Description | 
|---|---|
| XRRaycast | 
distance
The session-space distance from the raycast origin to the intersection point.
Declaration
public float distance { get; }
Property Value
| Type | Description | 
|---|---|
| Single | 
hitTrackableId
The TrackableId of the trackable hit by this raycast, or invalidId if none.
Declaration
public TrackableId hitTrackableId { get; }
Property Value
| Type | Description | 
|---|---|
| TrackableId | 
nativePtr
The pointer associated with this raycast. The data this pointer points to is implementation defined. Refer to the platform-specific AR package for details.
Declaration
public IntPtr nativePtr { get; }
Property Value
| Type | Description | 
|---|---|
| IntPtr | 
Implements
pose
The session-space Pose of this raycast's intersection with a target.
Declaration
public Pose pose { get; }
Property Value
| Type | Description | 
|---|---|
| Pose | 
Implements
trackableId
A unique identifier for this raycast.
Declaration
public TrackableId trackableId { get; }
Property Value
| Type | Description | 
|---|---|
| TrackableId | 
Implements
trackingState
The TrackingState of this raycast.
Declaration
public TrackingState trackingState { get; }
Property Value
| Type | Description | 
|---|---|
| TrackingState | 
Implements
Methods
Equals(Object)
Compares this raycast for equality with an object.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description | 
|---|---|---|
| Object | obj | The object to compare for equality.  | 
Returns
| Type | Description | 
|---|---|
| Boolean | 
  | 
Overrides
Equals(XRRaycast)
Compares this raycast for equality with another raycast.
Declaration
public bool Equals(XRRaycast other)
Parameters
| Type | Name | Description | 
|---|---|---|
| XRRaycast | other | The raycast with which to compare.  | 
Returns
| Type | Description | 
|---|---|
| Boolean | 
  | 
GetHashCode()
Computes a hash suitable for use in a Dictionary or HashSet.
Declaration
public override int GetHashCode()
Returns
| Type | Description | 
|---|---|
| Int32 | A hash code computed from this raycast's fields.  | 
Overrides
Operators
Equality(XRRaycast, XRRaycast)
Tests for equality between two XRRaycasts. Same as lhs.Equals(rhs)
Declaration
public static bool operator ==(XRRaycast lhs, XRRaycast rhs)
Parameters
| Type | Name | Description | 
|---|---|---|
| XRRaycast | lhs | The left-hand side of the comparison.  | 
| XRRaycast | rhs | The right-hand side of the comparison.  | 
Returns
| Type | Description | 
|---|---|
| Boolean | 
  | 
Inequality(XRRaycast, XRRaycast)
Tests for inequality between two XRRaycasts. Same as !lhs.Equals(rhs)
Declaration
public static bool operator !=(XRRaycast lhs, XRRaycast rhs)
Parameters
| Type | Name | Description | 
|---|---|---|
| XRRaycast | lhs | The left-hand side of the comparison.  | 
| XRRaycast | rhs | The right-hand side of the comparison.  | 
Returns
| Type | Description | 
|---|---|
| Boolean | 
  |