Aeva / m.grl

Midnight Graphics & Recreation Library
http://mgrl.midnightsisters.org
GNU Lesser General Public License v3.0
44 stars 3 forks source link

device orientation quaternion driver #115

Open Aeva opened 9 years ago

Aeva commented 9 years ago

The device orientation API periodically fires an event which contains the device's current orientation in space as expressed in degrees.

For this feature, m.grl should consume this event and cache the device orientation somewhere. Then, a driver function should exist that spits out the quaternion representation of this information, and possibly doing some other correction so as to put it in the correct coordinate space.

The ultimate idea here is that you can assign this to a camera's quaternion property and then have the viewport sync to the phone's physical orientation.

An example from the wild as to how this works can be found here: code, demo.

Aeva commented 8 years ago

It looks like this should be possible to do now, given that the https://webvr.info/samples/ "polyfill" webvr examples now work in firefox mobile.