Consider simplifying XR Anchors API into a single object
https://github.com/BabylonJS/BabylonNative/blob/c8204f0bfecd8929bbc9f00054247d4893a5a325/Dependencies/xr/Include/XR.h#L152-L154
The three API calls at that line could likely be simplified into one. Rather than, after receiving an Anchor object, manually updating it throughout its lifetime before manually destroying it, the API could simply return an object that XR keeps updated throughout its lifecycle and that calls native deletion mechanisms automatically when the object is discarded. Thus, the contract would shrink to a single call which retrieves an Anchor object which would remain updated an manage its lifecycle via implementation details.
Though slightly tangential, a change which might be worth pursuing at the same time as this would be to modify the HitTest API to make its mechanism a little more platform-agnostically opaque, likely involving replacing NativeAnchorPtr with another way of identifying the associated hit.