OpenXRAndroidAnchorTracker

Inherits: XRPositionalTracker

An anchor tracker (from XR_ANDROID_trackables).

Description

An anchor tracker (from XR_ANDROID_trackables).

OpenXRAndroidAnchorTrackers can be created by OpenXRAndroidTrackablesExtension.create_anchor_tracker and OpenXRAndroidDeviceAnchorPersistenceExtension.create_persisted_anchor_tracker.

All newly created OpenXRAndroidAnchorTrackers have up-to-date state, as in, no need to call get_persist_state and/or get_location_flags with update set to true.

When an OpenXRAndroidAnchorTracker is created by OpenXRAndroidTrackablesExtension.create_anchor_tracker, the trackable parameter can be set to either null or a plane OpenXRAndroidTrackableTracker.

The OpenXRAndroidAnchorTracker is called a "spatial anchor" when created with a null OpenXRAndroidTrackableTracker.

The OpenXRAndroidAnchorTracker is called a "plane anchor" when created with a plane OpenXRAndroidTrackableTracker.

The OpenXRAndroidAnchorTracker cannot be created with other OpenXRAndroidTrackableTracker types.

Methods

LocationFlags

get_location_flags ( bool update=false )

Transform3D

get_location_pose ( bool update=false )

PersistState

get_persist_state ( bool update=false )

StringName

get_persist_uuid ( ) const

OpenXRAndroidTrackableTracker

get_tracker ( ) const

bool

persist ( )

bool

unpersist ( )


Signals

location_flags_changed ( )

Signal emitted when a location flag has changed, which can be retrieved with get_location_flags.

This signal is not emitted when a location's pose changes, however this tracker's default pose is modified (and consequently its signal is also emitted) when the location transform changes.


persist_state_changed ( )

Signal emitted when the persist state changes, which can be retrieved with get_persist_state.


Enumerations

flags LocationFlags:

LocationFlags LOCATION_FLAGS_ORIENTATION_VALID = 1

Indicates that the Transform3D.basis returned by get_location_pose is valid.

Applications must not read Transform3D.basis if this flag is unset.

LocationFlags LOCATION_FLAGS_POSITION_VALID = 2

Indicates that the Transform3D.origin returned by get_location_pose is valid.

Applications must not read Transform3D.origin if this flag is unset.

LocationFlags LOCATION_FLAGS_ORIENTATION_TRACKED = 4

Indicates that the Transform3D.basis returned by get_location_pose represents an actively tracked orientation.

LocationFlags LOCATION_FLAGS_POSITION_TRACKED = 8

Indicates that the Transform3D.origin returned by get_location_pose represents an actively tracked position.


enum PersistState:

PersistState PERSIST_STATE_NOT_REQUESTED = 0

The anchor tracker has not requested to be persisted.

PersistState PERSIST_STATE_PENDING = 1

The anchor tracker requested to be persisted, but is not persisted yet.

PersistState PERSIST_STATE_PERSISTED = 2

The anchor tracker is persisted.

PersistState PERSIST_STATE_ERROR = 3

An error occurred when persisting the anchor tracker.


Method Descriptions

LocationFlags get_location_flags ( bool update=false )

Get the LocationFlags.

If update is false, then get the cached location flags.

If update is true, then query the XR runtime for the latest location and location flags, which may be identical to the cached location.

If the new location changed from the cached value, then the cached value is updated, location_flags_changed is emitted if the flags changed, and XRPositionalTracker.pose_changed is emitted if the location's Transform3D changed.


Transform3D get_location_pose ( bool update=false )

Convenience function to turn this:

anchor_tracker.get_location_flags(true)
var anchor_pose: Transform3D = anchor_tracker.get_pose(&"default").get_transform()

Into:

var anchor_pose: Transform3D = anchor_tracker.get_location_pose(true)

See get_location_flags for update documentation.


PersistState get_persist_state ( bool update=false )

Get the PersistState.

If update is false, then get the cached persist state.

If update is true, then query the XR runtime for the latest persist state, which may be identical to the cached persist state.

If the new persist state changed from the cached value, the cached value is updated and persist_state_changed is emitted.


StringName get_persist_uuid ( ) const

Get the persisted anchor uuid, represented as a StringName.

The returned StringName is non-empty if this anchor tracker is persisting or persisted. See also get_persist_state to get the actual persisted state.

The returned StringName is empty if this anchor tracker is not persisted.


OpenXRAndroidTrackableTracker get_tracker ( ) const

Return the OpenXRAndroidTrackableTracker that this OpenXRAndroidAnchorTracker was created with.

This method always returns null for OpenXRAndroidAnchorTrackers created with OpenXRAndroidDeviceAnchorPersistenceExtension.create_persisted_anchor_tracker, even if the original anchor was created with an OpenXRAndroidTrackableTracker.


bool persist ( )

Persist this anchor tracker.

Returns true if the anchor tracker was persisted successfully, or it was already persisted.

NOTE: it takes some time for the XR runtime to persist an anchor tracker (usually less than a second, but sometimes longer). Connect to persist_state_changed to be notified when this tracker is persisted.


bool unpersist ( )

Unpersist this anchor tracker.

Returns true if the anchor tracker was unpersisted successfully, or it was already unpersisted.

NOTE: it takes some time for the XR runtime to unpersist an anchor tracker (usually less than a second, but sometimes longer). Connect to persist_state_changed to be notified when this tracker is unpersisted.