immersive-web / anchors

https://immersive-web.github.io/anchors/
Other
50 stars 20 forks source link

No way to detect if a feature is enabled for a session. #64

Open Maksims opened 3 years ago

Maksims commented 3 years ago

Currently, there is no way to detect if anchors feature has been enabled for the session.

Some other APIs provide some way to detect a feature, e.g. plane-detection throws an exception when trying to access detectedPlanes property, which I've argued is not a good API design here: https://github.com/immersive-web/real-world-geometry/issues/30

Regardless of anchors feature been enabled or not on the session, XRFrame has a property trackedAnchors that always returns a Set-like object.

For consistency across APIs, it would be best to not return Set, but either throw an exception as in plane-detection, or better to be null if the feature is not available on the session.

That way, the developer has a graceful way to detect if anchors feature is enabled or not.

bialpio commented 3 years ago

Currently, there is no way to detect if anchors feature has been enabled for the session.

This was discussed in immersive-web/webxr#952 - the spec describes a way to query the features that have been enabled on a session through Permissions API. Unfortunately, I don't think this is currently implemented in Chrome. :frowning_face: With that said, I wouldn't mind adding additional XRSession property that would contain features enabled for a session, but that would mean we have 2 ways of achieving the same thing, so I doubt it will end up happening.

At this point, changing how trackedAnchors behave would be a breaking change so I'd be very hesitant to adjust this, but I agree that detectedPlanes should behave consistently with them, thanks for catching this mismatch!