Interface ITrackable
Defines the interface for a trackable. A trackable represents anything that can be detected and tracked in the physical environment.
Namespace: UnityEngine.XR.ARSubsystems
Assembly: Unity.XR.ARSubsystems.dll
Syntax
public interface ITrackable
Properties
nativePtr
The native pointer associated with this trackable.
Declaration
IntPtr nativePtr { get; }
Property Value
Type | Description |
---|---|
IntPtr | The native pointer. |
Remarks
The data pointed to by this pointer is defined by the provider plug-in implementation. Refer to the provider documentation for each platform your app supports to learn more about the value of this pointer on your target platform(s).
parentId
The TrackableId
of the parent trackable, if any.
Declaration
TrackableId parentId { get; }
Property Value
Type | Description |
---|---|
TrackableId | The |
pose
The Pose
, in session space, associated with this trackable.
Declaration
Pose pose { get; }
Property Value
Type | Description |
---|---|
Pose | The pose. |
Examples
Some `ITrackable` implementations are MonoBehaviours, and you can use the Transform component of their GameObjects to access the position and rotation of a trackable in Unity world space. For other trackables without associated GameObjects, you can convert a session-space pose to Unity world space if needed by using the example code below, assuming the XR Origin has a uniform scale of (1, 1, 1):
var origin = FindAnyObjectByType<XROrigin>().transform;
var originPose = new Pose(origin.position, origin.rotation);
var worldSpacePose = pose.GetTransformedBy(xrOriginPose);
trackableId
The TrackableId
associated with this trackable.
Declaration
TrackableId trackableId { get; }
Property Value
Type | Description |
---|---|
TrackableId | The |
trackingState
The TrackingState
associated with this trackable.
Declaration
TrackingState trackingState { get; }
Property Value
Type | Description |
---|---|
TrackingState | The |