Struct XRRaycast
Represents the intersection of a raycast with a trackable.
Inherited Members
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 can be different from a zero-initialized raycast.
Declaration
public static readonly XRRaycast defaultValue { get; }
Property Value
Type | Description |
---|---|
XRRaycast |
distance
The session-space distance from the raycast origin to the intersection point.
Declaration
public readonly float distance { get; }
Property Value
Type | Description |
---|---|
Single |
hitTrackableId
The TrackableId of the trackable hit by this raycast, or invalidId if none.
Declaration
public readonly 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 readonly IntPtr nativePtr { get; }
Property Value
Type | Description |
---|---|
IntPtr |
Implements
pose
The session-space Pose
of this raycast's intersection with a target.
Declaration
public readonly Pose pose { get; }
Property Value
Type | Description |
---|---|
Pose |
Implements
trackableId
A unique identifier for this raycast.
Declaration
public readonly TrackableId trackableId { get; }
Property Value
Type | Description |
---|---|
TrackableId |
Implements
trackingState
The TrackingState of this raycast.
Declaration
public readonly 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 |
|
Implements
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 |
|