google-ar / three.ar.js

A helper three.js library for building AR web experiences that run in WebARonARKit and WebARonARCore
https://developers.google.com/ar/develop/web/getting-started
Apache License 2.0
2.91k stars 365 forks source link

tracking state from AR sdks #66

Closed jimmy-jam closed 6 years ago

jimmy-jam commented 6 years ago

I want to be able to find out what the tracking state is on my device from JS, so that I can provide UI to improve the experience.
the native code to detect these states appear to be there on webARonARKit at least.

https://developer.apple.com/documentation/arkit/artrackingstate?language=objc https://developers.google.com/ar/reference/java/com/google/ar/core/Frame.TrackingState - though it seems to have more granular methods on planes and anchors

jsantell commented 6 years ago

Currently, tracking state can be found by whether or not the VRDisplay is reporting a position; the more granular state info on ARKit (ARTrackingStateLimited) doesn't have an equivalent on ARCore, and unlikely we'll expose this to the web beyond general position information; @judax thoughts?

judax commented 6 years ago

I agree that exposing explicit tracking state is interesting but the WebVR spec seems to think differently and tracking loss is exposed as the lack of a pose. In these prototypes we could use the fact that VRDisplays are event emitters to expose these state but as @jsantell explained, we should try to be consistent between ARKit and ARCore.

Is using the "trick" of using the position as a way to know if tracking is lost, a temporary solution for your use case?

jimmy-jam commented 6 years ago

I think AR is different in the respect that we can ask the user via UI/UX hints to change their environment in low light or looking for more feature points - and we can also recover from these tracking losses. So if we have a way to realize this happened, and to hint to the user how to recover, it will provide a more enjoyable experience.

jsantell commented 6 years ago

AR proposals are now landing in the Immersive Web organization: hit-test, anchors -- closing this, as this will be addressed by the WebXR standard