GodotVR / godot_openxr_vendors

Godot 4 wrapper for OpenXR vendors loaders and extensions
MIT License
99 stars 22 forks source link

Add support for developer-created spatial anchors via XR_FB_spatial_entity #121

Closed dsnopek closed 5 months ago

dsnopek commented 5 months ago

This is a follow-up to PR https://github.com/GodotVR/godot_openxr_vendors/pull/107 which added support for scene anchors (aka the data from Meta's scene understanding).

This PR adds the ability for the developer to create and manage their own spatial anchors.

Here's a screenshot from the demo:

org godotengine openxr vendors demo-20240415-165709

When you switch into passthrough mode, you can press the trigger on a surface from scene understanding (aka a scene anchor) and place a spatial anchor, which is represented by a colored cone (the color is selected randomly). If you point at an existing spatial anchor, pressing the trigger will remove it. If you close and open the app again, the spatial anchors will be restored with the same colors they had previously.

This is done via a new node called OpenXRFbSpatialAnchorManager which works a lot like the OpenXRFbSceneManager which was added in PR https://github.com/GodotVR/godot_openxr_vendors/pull/107

Here's how it works:

Here's the properties in the editor:

Selection_149

dsnopek commented 5 months ago

Rebased after recent merges!

dsnopek commented 5 months ago

This is updated per @m4gr3d's requested changes, and rebased on all the recent merges