richtr / threeVR

An orientation-aware Virtual Reality controller for web browsers built on top of three.js
http://richtr.github.io/threeVR/examples/vr_basic.html
437 stars 99 forks source link

DeviceOrientationController moving on its own #5

Open marciopuga opened 9 years ago

marciopuga commented 9 years ago

Is the DeviceOrientationController weirdly moving on its own while you hold the device still? I cant get rid of it.

richtr commented 9 years ago

Could you tell us what device, OS and browser (+ versions) are you using?

Is the movement jerky or are you experiencing small incremental drift?

This could be occurring for a number of reasons but we may be able to remove it by implementing a low/high pass filter on the raw data collected. This hasn't been added to date because the latest browser versions tend to provide already smoothed device orientation data. Have you tried this approach?

marciopuga commented 9 years ago

Sorry, completely forgot this bit. I'm testing on a LG Nexus 4, Android Version 4.4.4, Chrome 37.0.2062.117, Yes! it's a weird small incremental drift. I think the low/pass filter would actually smooth the results. Thanks for the idea.

richtr commented 9 years ago

Let me know if you come up with anything here. I think this would be a useful addition to this project as it would also solve jerky sensor data I've observed being returned from older devices/browsers.

Other than that, incremental drift sounds like an implementation issue in sensor data being returned. It would be best to file such bugs against specific projects (e.g. Android and/or Chromium) so we can fix these issues at the platform level.

marciopuga commented 9 years ago

After some testing I've also found out that (it sounds super obvious now) some of the drift was being caused by magnets affecting the compass. Easy to reproduce with headphones.

marciopuga commented 9 years ago

This chromium issue [https://code.google.com/p/chromium/issues/detail?id=397824] might also explain a why the android native app behaves better with the drifts

richtr commented 9 years ago

I've suggested that we use GAME_ROTATION_VECTOR for DeviceOrientation Event data @ http://lists.w3.org/Archives/Public/public-geolocation/2014Aug/0001.html. The main concern there is how we could then still be able to compute compass-based deviceorientation. Any thoughts here or on that mailing list would be great.

It's worth noting that iOS already does this. DeviceOrientation data in iOS is not based on magnetometer inputs (or, at least, that is my current understanding).

Interested in further thoughts you have here and whether we can provide any improvements at the JavaScript level or any further insights for the API standard.