Struct XRRaycastHit
Represents the intersection of a raycast with a trackable.
Inherited Members
Namespace: UnityEngine.XR.ARSubsystems
Syntax
public struct XRRaycastHit : IEquatable<XRRaycastHit>
Constructors
XRRaycastHit(TrackableId, Pose, Single, TrackableType)
Constructs an XRRaycastHit.
Declaration
public XRRaycastHit(TrackableId trackableId, Pose pose, float distance, TrackableType hitType)
Parameters
Type | Name | Description |
---|---|---|
TrackableId | trackableId | The TrackableId of the trackable which was hit. |
Pose | pose | The session-space |
Single | distance | The session-space distance from the raycast origin to the intersection point. |
TrackableType | hitType | The types of trackables which were hit by the ray. |
Properties
defaultValue
A default-initialized raycast hit. This can be different from a zero-initialized raycast hit.
Declaration
public static readonly XRRaycastHit defaultValue { get; }
Property Value
Type | Description |
---|---|
XRRaycastHit |
distance
The session-space distance from the raycast origin to the intersection point.
Declaration
public float distance { get; set; }
Property Value
Type | Description |
---|---|
Single |
hitType
The types of trackables which were hit by the ray.
Declaration
public TrackableType hitType { get; set; }
Property Value
Type | Description |
---|---|
TrackableType |
pose
The session-space Pose
of the intersection.
Declaration
public Pose pose { get; set; }
Property Value
Type | Description |
---|---|
Pose |
trackableId
The TrackableId of the trackable which was hit. This can be invalidId as some trackables (for example, feature points) don't have ids.
Declaration
public TrackableId trackableId { get; set; }
Property Value
Type | Description |
---|---|
TrackableId |
Methods
Equals(Object)
Tests for equality.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The |
Returns
Type | Description |
---|---|
Boolean |
|
Overrides
Equals(XRRaycastHit)
Tests for equality.
Declaration
public bool Equals(XRRaycastHit other)
Parameters
Type | Name | Description |
---|---|---|
XRRaycastHit | other | The other XRRaycastHit to compare against. |
Returns
Type | Description |
---|---|
Boolean |
|
Implements
GetHashCode()
Generates a hash suitable for use with containers like HashSet
and Dictionary
.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code generated from this object's fields. |
Overrides
Operators
Equality(XRRaycastHit, XRRaycastHit)
Tests for equality. Same as Equals(XRRaycastHit).
Declaration
public static bool operator ==(XRRaycastHit lhs, XRRaycastHit rhs)
Parameters
Type | Name | Description |
---|---|---|
XRRaycastHit | lhs | The left-hand side of the comparison. |
XRRaycastHit | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
Boolean |
|
Inequality(XRRaycastHit, XRRaycastHit)
Tests for inequality. Same as !
Equals(XRRaycastHit).
Declaration
public static bool operator !=(XRRaycastHit lhs, XRRaycastHit rhs)
Parameters
Type | Name | Description |
---|---|---|
XRRaycastHit | lhs | The left-hand side of the comparison. |
XRRaycastHit | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
Boolean |
|