AR-js-org / AR.js

Image tracking, Location Based AR, Marker tracking. All on the Web.
MIT License
5.3k stars 909 forks source link

Location based compass orientation is incorrect. It always says North is direction when starting up. #590

Open beachgrub opened 6 months ago

beachgrub commented 6 months ago

Bug. There are similar issue but all marked as closed, incorrectly.

What is the current behavior? Currently on iOS (Safari and Chrome tested) the simple location examples will always point the north cube in the direction the phone is facing after any interaction or started. If the current behavior is a bug, please provide the steps to reproduce. Load the basic example https://github.com/AR-js-org/AR.js/blob/master/aframe/examples/new-location-based/basic-js/index.html On iOS at startup there will always be several permissions popups. After hitting them all you will see the Red cube (North) in the direction of whatever you started. If you tap the cube or any cube, you will get a popup and then the orientation will reset so that direction is North and the Red Cube is there.

It is always happening with the included example. I put a copy on website at www.pasotours.com/location2

Please mention other relevant information such as the browser version, Operating System and Device Name iOS (Chrome and Safari) it works correctly on android. What is the expected behavior?

If this is a feature request, what is motivation or use case for changing the behavior?

beachgrub commented 6 months ago

It looks to me like iOS no longer supports the compass deviceorientationabsolute event. It only supports the deviceorientation event and that seems to reset with the context in some way. In the basic example when you tap on a cube when it returns the device orientation resets with alpha = 0 regardless of the direction facing. I believe on ios you now need to support the webkitcompassheading event to know which way the phone is facing absolutely. https://developer.apple.com/documentation/webkitjs/deviceorientationevent/1804777-webkitcompassheading

beachgrub commented 6 months ago

It appears that this is know. There was a MR that was not merged that seems to help but enabling the webkitcompassheading. https://github.com/AR-js-org/AR.js/issues/466

nickw1 commented 2 months ago

We really need developers who have an iOS device, this will help progress the iOS issues and allow the merging of #466.

Also see #278 and #603.