AR Anchor Creation Fails with 'Unbounded' Reference Space on Meta Quest 3

In AR with Meta Quest 3, when referenceSpaceType is set to 'unbounded' and the anchorSystem.addAnchorAtPositionAndRotationAsync function is used, it throws an error:

“Error creating anchor: OperationError Failed to execute ‘createAnchor’ on ‘XRFrame’: Anchor creation failed”

This issue was briefly mentioned back in a 2021 thread:

The problem still exists. To get anchors working in AR, we have to enable a boundary using "local-floor" but that’s not ideal. The boundary is really meant for VR, not AR, and feels like an unnecessary restriction. Anchors are mainly for AR and should work without it.

Here’s a full reproduction playground:
WebXR Anchor in AR problem | Babylon.js Playground

Can you trace the bug enough to see whether it’s caused by the WebXR API itself or something in Babylon?

It’s interesting that the error doesn’t happen when using hit test. If the anchor is created with anchorSystem.addAnchorPointUsingHitTestResultAsync, it works fine with 'unbounded'.

Here’s a modified playground using 'unbounded' and hit test:
WebXR measurement tape | Babylon.js Playground

What’s the key difference between addAnchorAtPositionAndRotationAsync and addAnchorPointUsingHitTestResultAsync that causes this error?

Thank you!

The difference between the two is the way the anchor is created.

A hit test has the option to create an anchor using the data from the hit test itself (with an offset) - WebXR Anchors Module
The other function uses the native anchor creation function - WebXR Anchors Module
Nowhere in the specs does it mention the reference space type. Both functions should work correctly with any reference space type. And with every reference space.

Restriction that is added by the browser vendor, not Babylon.js. Unless I am doing something wrong (which is ALWAYS possible) when adding an anchor (which I will gladly debug), this is a browser limitation.