Struct XRRaycast
Represents the intersection of a raycast with a trackable.
Inherited Members
Namespace: UnityEngine.XR.ARSubsystems
Assembly: Unity.XR.ARSubsystems.dll
Syntax
public struct XRRaycast : ITrackable, IEquatable<XRRaycast>
Constructors
XRRaycast(TrackableId, Pose, TrackingState, IntPtr, float, 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. |
float | 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 can 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 |
---|---|
float |
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 |
pose
The session-space Pose
of this raycast's intersection with a target.
Declaration
public Pose pose { get; }
Property Value
Type | Description |
---|---|
Pose |
trackableId
A unique identifier for this raycast.
Declaration
public TrackableId trackableId { get; }
Property Value
Type | Description |
---|---|
TrackableId |
trackingState
The TrackingState of this raycast.
Declaration
public TrackingState trackingState { get; }
Property Value
Type | Description |
---|---|
TrackingState |
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 |
---|---|
bool |
|
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 |
---|---|
bool |
|
GetHashCode()
Computes a hash suitable for use in a Dictionary
or HashSet
.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code computed from this raycast's fields. |
Overrides
Operators
operator ==(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 |
---|---|
bool |
|
operator !=(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 |
---|---|
bool |
|