-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add W3C DeviceOrientation Event controls and demo #4475
Conversation
This really relies on Beta versions! :) It seems work pretty well, albeit not perfect? It's hard to describe what's going on... Maybe we need a debug cubemap for this? |
It's pretty great though! |
Merged! Thanks! |
Thanks! Yes, this does rely on 'beta' versions of browsers. There is a lot of activity happening in 'next' versions of mobile browsers and I think this provides a state-of-the-art snapshot for those developments. Certainly looking forward to more feedback on this from developers. |
Cool! Chrome for Mac also reports DeviceOrientation. However, the angle is relative to the screen (which is what the spec says), not to the keyboard, so you have to open it at 90 deg. and hold the screen as if it was a tablet with the body facing you for it to work. |
With the same idea (issue 4495), I worked on a MotionControl that can be easily integrated in a scene: https://github.com/jbouny/motioncontrols One other thing that will arrive one day, is screen.lockOrientation: http://www.w3.org/TR/screen-orientation/ |
Oh true... I forgot about that. I always have the orientation thing disabled but I forgot that it's enabled by default :S |
Hi @jbouny. I really like this particularly the way you attempt to re-wire the device orientation axis' as screen orientation changes (so no particular compensation is needed on the part of developers). I demonstrated an alternate way developers can compensate for screen orientation changes in the provided demo (by rotating the canvas by -window.orientation. see: https://github.com/mrdoob/three.js/blob/dev/examples/misc_controls_deviceorientation.html#L98-L107) Perhaps we could adopt your work in #4495 on compensating for screen orientation changes directly in DeviceOrientationControls.js rather than always having to relying on developers implementing such a canvas element rotation hack for this? |
Thanks @richtr! Yep, I tried to simplify the use of the control for developers without specific actions. It's also a nice idea to rotate the canvas. I will try to test the integration of some elements inside your work as soon as possible. I hope and think we can build a robust and simple solution! (Need to see 'devicemotion' event you are right) |
@richtr |
@richtr sorry would love to look into this, but i don't have the time right now. could you load up the controls with an empty scene to check if that crashes the browser? otherwise, it could be the panorama taking up too much memory... |
The latest example currently does not work well in Firefox for Android. I started a commit to try to solve this problem.., but ran into a wall. You can try the It's better than what currently exists because it takes into account the lack of I did some light research. When you rotate your phone in landscape to look from the floor to the ceiling Chrome and Firefox behave differently:
Someone else seems to have found this difference as well. I however don't know enough about |
Provide camera controls based on the W3C Device Orientation Event specification (http://www.w3.org/TR/orientation-event/).
A demo using these controls is included in this patch and it can be viewed directly in a browser @ http://richtr.github.io/three.js/examples/misc_controls_deviceorientation.html.
THREE.DeviceOrientationControls currently works well in the following browsers:
Note: Other browsers may not yet conform to the rotation calibration described in the DeviceOrientation Event specification.
A full W3C DeviceOrientation event browser support table is available at http://caniuse.com/#feat=deviceorientation.
Detection of browser/platform deviceorientation capabilities or anomalies remain out-of-scope of this patch. Developers may test for the presence and calibration of DeviceOrientation Events prior to invoking this DeviceOrientation control.