It's centered around a new OpenXRFbSceneManager node, where you configure scenes to be instantiated for each scene anchor depending on it's semantic labels:
For each scene anchor that it discovers, it creates an XRAnchor3D node (which gets its position from an XRPositionTracker) <-- this is the generic support for anchors already built into Godot, which is also used by the ARKit plugin
And then depending on the semantic labels of the scene anchor, it instantiates the given scene and makes it a child of the XRAnchor3D, and calls a method on it with an OpenXRFbSpatialEntity object, which the developer can use to query any information they want about the anchor, for example, including easily creating a MeshInstance3D or CollisionShape3D.
The demo project uses this to place some boxes and labels in the room based on the captured scene data:
Press the Y button to toggle on/off passthrough (the scene anchors will only be shown when in passthrough) and the Menu button to do scene capture.
I also took the opportunity to make a friendlier way to access the scene capture API. Rather than calling OpenXRFbSceneCaptureExtensionWrapper.request_scene_capture(), this PR adds a similar method on the OpenXRFbSceneManager node, so developers should be able to do everything related to scene anchors via that node (never having to interact with the singletons).
This PR was already getting huge, so there's a couple things I've left out for now, which I plan to add in follow-ups:
Getting the triangle mesh for an anchor - this requires integrating with the XR_FB_triangle_mesh extension
Developer-created spatial anchors (this PR only covers scene anchors)
This builds on the work from PR https://github.com/GodotVR/godot_openxr_vendors/pull/66 which added extension wrappers for XR_FB_scene and all the related extensions, but didn't expose a nice developer-facing API.
This PR adds that API!
It's centered around a new
OpenXRFbSceneManager
node, where you configure scenes to be instantiated for each scene anchor depending on it's semantic labels:For each scene anchor that it discovers, it creates an
XRAnchor3D
node (which gets its position from anXRPositionTracker
) <-- this is the generic support for anchors already built into Godot, which is also used by the ARKit pluginAnd then depending on the semantic labels of the scene anchor, it instantiates the given scene and makes it a child of the
XRAnchor3D
, and calls a method on it with anOpenXRFbSpatialEntity
object, which the developer can use to query any information they want about the anchor, for example, including easily creating aMeshInstance3D
orCollisionShape3D
.The demo project uses this to place some boxes and labels in the room based on the captured scene data:
I also took the opportunity to make a friendlier way to access the scene capture API. Rather than calling
OpenXRFbSceneCaptureExtensionWrapper.request_scene_capture()
, this PR adds a similar method on theOpenXRFbSceneManager
node, so developers should be able to do everything related to scene anchors via that node (never having to interact with the singletons).This PR was already getting huge, so there's a couple things I've left out for now, which I plan to add in follow-ups:
XR_FB_triangle_mesh
extension