Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
OpenXRSpatialAnchorCapability
Experimental: This class may be changed or removed in future versions.
Hereda: OpenXRExtensionWrapper < Object
Implementation for handling spatial entity anchor logic.
Descripción
This is an internal class that handles the OpenXR anchor spatial entity extension.
Métodos
create_default_persistence_context(user_callback: Callable = Callable()) |
|
create_new_anchor(transform: Transform3D, spatial_context: RID = RID(), next: OpenXRStructureBase = null) |
|
create_persistence_context(scope: PersistenceScope, user_callback: Callable = Callable()) |
|
void |
do_entity_update(spatial_context: RID, component_data: Array[OpenXRSpatialComponentData], next_snapshot_create: OpenXRStructureBase = null, next_snapshot_query: OpenXRStructureBase = null) |
void |
free_persistence_context(persistence_context: RID) |
get_persistence_context_handle(persistence_context: RID) const |
|
persist_anchor(anchor_tracker: OpenXRAnchorTracker, persistence_context: RID = RID(), user_callback: Callable = Callable()) |
|
void |
remove_anchor(anchor_tracker: OpenXRAnchorTracker) |
start_entity_discovery(spatial_context: RID, component_data: Array[OpenXRSpatialComponentData], next_snapshot_create: OpenXRStructureBase = null, next_snapshot_query: OpenXRStructureBase = null, user_callback: Callable = Callable()) |
|
unpersist_anchor(anchor_tracker: OpenXRAnchorTracker, persistence_context: RID = RID(), user_callback: Callable = Callable()) |
Enumeraciones
enum PersistenceScope: 🔗
PersistenceScope PERSISTENCE_SCOPE_SYSTEM_MANAGED = 1
Proporciona a la aplicación acceso de solo lectura (es decir, la aplicación no puede modificar este ámbito) a las entidades espaciales persistentes y gestionadas por el sistema. La aplicación puede usar el UUID en el componente de persistencia para este ámbito para correlacionar entidades entre contextos espaciales y reinicios del dispositivo.
PersistenceScope PERSISTENCE_SCOPE_LOCAL_ANCHORS = 1000781000
Las operaciones de persistencia y el acceso a los datos están limitados a las anclas espaciales, en el mismo dispositivo, para el mismo usuario y la misma aplicación (usando las funciones persist_anchor() y unpersist_anchor())
Descripciones de Métodos
OpenXRFutureResult create_default_persistence_context(user_callback: Callable = Callable()) 🔗
Calls create_persistence_context() with a configuration that likely works with the XR runtime.
user_callback is called when the context is created.
OpenXRAnchorTracker create_new_anchor(transform: Transform3D, spatial_context: RID = RID(), next: OpenXRStructureBase = null) 🔗
Creates a new anchor that will be tracked by the XR runtime. The transform should be a transform in the local space of your XROrigin3D node. If spatial_context is not specified the default will be used, this requires ProjectSettings.xr/openxr/extensions/spatial_entity/enable_builtin_anchor_detection to be set. The returned tracker will track the location in case our reference space changes.
next must be a valid next object for the XrSpatialAnchorCreateInfoEXT chain.
OpenXRFutureResult create_persistence_context(scope: PersistenceScope, user_callback: Callable = Callable()) 🔗
Creates a new persistence context for storing persistent data.
Note: This is an asynchronous method and returns an OpenXRFutureResult object with which to track the status, discarding this object will not cancel the creation process. On success user_callback will be called if specified. The result value for this function is the RID for our persistence context.
void do_entity_update(spatial_context: RID, component_data: Array[OpenXRSpatialComponentData], next_snapshot_create: OpenXRStructureBase = null, next_snapshot_query: OpenXRStructureBase = null) 🔗
Calls OpenXRSpatialEntityExtension.update_spatial_entities() and OpenXRSpatialEntityExtension.query_snapshot() with the anchor entities associated with spatial_context.
component_data are the OpenXRSpatialComponentDatas to update for this anchor capability.
If next_snapshot_create is non-null, then pass this to the next parameter in OpenXRSpatialEntityExtension.update_spatial_entities().
If next_snapshot_query is non-null, then pass this to the next parameter in OpenXRSpatialEntityExtension.query_snapshot().
void free_persistence_context(persistence_context: RID) 🔗
Frees a persistence context previously created with create_persistence_context().
int get_persistence_context_handle(persistence_context: RID) const 🔗
Returns the internal handle for this persistence context.
Note: For GDExtension implementations.
bool is_persistence_scope_supported(scope: PersistenceScope) 🔗
Returns true if this persistence scope is supported by our spatial anchor capability.
Note: Only valid after an OpenXR instance has been created.
bool is_spatial_anchor_supported() 🔗
Returns true if spatial anchors are supported by the hardware. Only returns a valid value after OpenXR has been initialized.
bool is_spatial_persistence_supported() 🔗
Returns true if persistent spatial anchors are supported by the hardware. Only returns a valid value after OpenXR has been initialized.
OpenXRFutureResult persist_anchor(anchor_tracker: OpenXRAnchorTracker, persistence_context: RID = RID(), user_callback: Callable = Callable()) 🔗
Changes this anchor into a persistent anchor. This means its location will be stored on the device and the anchor will be restored the next time your application starts. If persistence_context is not specified the default will be used, this requires ProjectSettings.xr/openxr/extensions/spatial_entity/enable_builtin_anchor_detection to be set.
Note: This is an asynchronous method and returns an OpenXRFutureResult object with which to track the status, discarding this object will not cancel the creation process. On success user_callback will be called if specified. The result value for this function is a boolean which will be set to true on successful completion.
void remove_anchor(anchor_tracker: OpenXRAnchorTracker) 🔗
Elimina un ancla creada previamente con create_new_anchor(). Si este ancla era persistente, primero debes llamar a unpersist_anchor() y esperar su devolución de llamada.
OpenXRFutureResult start_entity_discovery(spatial_context: RID, component_data: Array[OpenXRSpatialComponentData], next_snapshot_create: OpenXRStructureBase = null, next_snapshot_query: OpenXRStructureBase = null, user_callback: Callable = Callable()) 🔗
Calls OpenXRSpatialEntityExtension.discover_spatial_entities() and OpenXRSpatialEntityExtension.query_snapshot() with the anchor entities associated with spatial_context.
component_data are the OpenXRSpatialComponentDatas to discover for this anchor capability.
If next_snapshot_create is non-null, then pass this to the next parameter in OpenXRSpatialEntityExtension.discover_spatial_entities().
If next_snapshot_query is non-null, then pass this to the next parameter in OpenXRSpatialEntityExtension.query_snapshot().
user_callback, when non-null, is called with two parameters usually twice. The first parameter is the RID of the discovery snapshot and the second parameter is a boolean where false indicates the discovery snapshot is about to be processed, and true indicates the discovery snapshot has been processed and component_data has valid data. The second call is skipped if an error was encountered.
The returned OpenXRFutureResult is identical to the return from OpenXRSpatialEntityExtension.discover_spatial_entities().
OpenXRFutureResult unpersist_anchor(anchor_tracker: OpenXRAnchorTracker, persistence_context: RID = RID(), user_callback: Callable = Callable()) 🔗
Elimina los datos persistentes de esta ancla. El tiempo de ejecución no recreará el ancla cuando tu aplicación se reinicie. Si no se especifica persistence_context, se utilizará el predeterminado; esto requiere que ProjectSettings.xr/openxr/extensions/spatial_entity/enabled esté activado.
Nota: Este es un método asíncrono y devuelve un objeto OpenXRFutureResult para rastrear el estado; descartar este objeto no cancelará el proceso de creación. En caso de éxito, se llamará a user_callback si se especifica. El valor de resultado de esta función es un booleano que se establecerá en true al completarse con éxito.