OpenXRAndroidTrackablesObjectExtension

Inherits: OpenXRExtensionWrapper

Implementation for object trackables (from XR_ANDROID_trackables_object).

Description

Implementation for object trackables (from XR_ANDROID_trackables_object).

Depends on OpenXRAndroidTrackablesExtension.

Methods

RID

create_object_context ( Array object_labels )

void

discover_object_trackers ( bool update_trackers, RID object_context=RID() )

void

free_object_context ( RID object_context )

RID

get_default_object_context ( )

bool

is_trackables_object_supported ( ) const

void

set_default_object_context_enabled ( bool enabled )

void

set_object_tracker_discovery_cooldown ( int cooldown )


Method Descriptions

RID create_object_context ( Array object_labels )

Create a new context to be used in other methods in this class.

This is optional, unless if set_default_object_context_enabled was called earlier with false.


void discover_object_trackers ( bool update_trackers, RID object_context=RID() )

Discover object trackers detected by the OpenXR runtime.

New object trackers since the last call to discover_object_trackers are added to XRServer.

Missing object trackers since the last call to discover_object_trackers are removed from XRServer.

If update_trackers is true, all found trackers are updated.

If update_trackers is false, all found trackers are not updated. This is useful if you need to find new trackers/discard old trackers without updating all of them too.

If object_context is valid, then only discover object trackers for that object context.

If object_context is invalid, then discover all object trackers, including for all object contexts created by create_object_context.

This method does nothing if set_default_object_context_enabled was called earlier with false, object_context is null, and create_object_context was not called or all contexts have been free'd by free_object_context.

This API is called automatically by default (see set_object_tracker_discovery_cooldown).


void free_object_context ( RID object_context )

Removes all object trackers that it found from XRServer and frees the object context created by create_object_context.


RID get_default_object_context ( )

Get the default object context that is used to automatically discover objects with no additional setup.

Always returns an invalid RID if set_default_object_context_enabled was previously called with false.


bool is_trackables_object_supported ( ) const

Returns true if object trackables is supported; otherwise false.


void set_default_object_context_enabled ( bool enabled )

Set whether this extension should automatically use the default object context returned by get_default_object_context.

When enabled is true, the default object context is created (if it's invalid) and used in the next call to discover_object_trackers.

When enabled is false, the default object context is destroyed (if it's valid) by calling free_object_context immediately.


void set_object_tracker_discovery_cooldown ( int cooldown )

Set how many frames to wait before automatically calling discover_object_trackers.

When cooldown is 0, discover_object_trackers is called every frame. Note that the XR runtime may not always have new data to retrieve.

When cooldown is less than zero, discover_object_trackers is no longer called automatically. Your app can explicitly discover object trackers by calling discover_object_trackers.

Default is 60.