OpenXRFbSceneManager

Inherits: Node

Provides an easy-to-use way to interact with Meta's Scene Understanding.

Description

Provides an easy-to-use way to interact with Meta's Scene Understanding.

This node allows you to register scenes to be instantiated for each scene anchor that is discovered, and provide a method that will be called on them after creation with a OpenXRFbSpatialEntity that can be used to setup the scene using data from the scene anchor.

Each instantiated scene will be added as a child of an XRAnchor3D node that will be positioned using tracking data from the headset.

Properties

bool

auto_create

true

PackedScene

default_scene

StringName

scene_setup_method

&"setup_scene"

bool

visible

true

Methods

bool

are_scene_anchors_created ( ) const

Error

create_scene_anchors ( )

XRAnchor3D

get_anchor_node ( StringName uuid ) const

Array

get_anchor_uuids ( ) const

OpenXRFbSpatialEntity

get_spatial_entity ( StringName uuid ) const

void

hide ( )

bool

is_scene_capture_enabled ( ) const

void

remove_scene_anchors ( )

bool

request_scene_capture ( String request="" ) const

void

show ( )


Signals

openxr_fb_scene_anchor_created ( Object scene_node, Object spatial_entity )

Emitted when a new scene anchor is created.

It will receive the scene that was instantiated, and the OpenXRFbSpatialEntity object representing the scene anchor.


openxr_fb_scene_capture_completed ( bool success )

Emitted when the scene capture process is completed.


openxr_fb_scene_data_missing ( )

Emitted after create_scene_anchors is called (or the OpenXR session has begun if auto_create is true), if no scene data can be found.

Depending on your application, this may be a good time to initiate the scene capture process via request_scene_capture.


Property Descriptions

bool auto_create = true

  • void set_auto_create ( bool value )

  • bool get_auto_create ( )

If enabled, this node will run create_scene_anchors when an OpenXR session starts.


PackedScene default_scene

  • void set_default_scene ( PackedScene value )

  • PackedScene get_default_scene ( )

The default scene to be instatiated for any scene anchor, if there isn't a scene registered for the given type of scene anchor.


StringName scene_setup_method = &"setup_scene"

  • void set_scene_setup_method ( StringName value )

  • StringName get_scene_setup_method ( )

The method that will be called on scenes after they have been instantiated for a scene anchor.

The method will be called with a single OpenXRFbSpatialEntity argument, representing the scene anchor.


bool visible = true

  • void set_visible ( bool value )

  • bool get_visible ( )

Controls the visibility of the scene anchors managed by this node.


Method Descriptions

bool are_scene_anchors_created ( ) const

Checks if the scene anchors have been created already or not.


Error create_scene_anchors ( )

Attempts to create the scene anchors discovered in the physical space around the user.

This is an asynchronous operation - the openxr_fb_scene_data_missing signal will be emitted if no scene data can be found, and the openxr_fb_scene_anchor_created signal will be emitted for each scene anchor successfully created.

This will only work during an active OpenXR session. If you've set auto_create to true, then this method will be called automatically when an OpenXR session has begun.


XRAnchor3D get_anchor_node ( StringName uuid ) const

Gets the XRAnchor3D node which was created for the spatial entity with the given UUID.

Note: All anchors will be created asynchronously, either by calling create_scene_anchors or when the OpenXR session begins if auto_create is set to true.


Array get_anchor_uuids ( ) const

Gets the UUIDs of all scene anchors that have been created.

Note: All anchors will be created asynchronously, either by calling create_scene_anchors or when the OpenXR session begins if auto_create is set to true.


OpenXRFbSpatialEntity get_spatial_entity ( StringName uuid ) const

Gets the spatial entity identified by the given UUID.

Note: Only works for spatial entities that were loaded as a result of calling create_scene_anchors or when the OpenXR session begins if auto_create is set to true.


void hide ( )

Hides all scene anchors created by this manager.


bool is_scene_capture_enabled ( ) const

Checks if scene capture is enabled.


void remove_scene_anchors ( )

Removes all scene anchors.

This will be done automatically when the OpenXR session ends, or when this node is removed from the scene tree.


bool request_scene_capture ( String request="" ) const

Requests the user go through the scene capture process.

This will only work if scene capture is enabled, which can be checked by calling is_scene_capture_enabled.

The openxr_fb_scene_capture_completed signal will be emitted when the process has completed.


void show ( )

Shows all scene anchors created by this manager, if they had been previously hidden.