three.js icon indicating copy to clipboard operation
three.js copied to clipboard

MotionControls, control the camera with gyroscope

Open jbouny opened this issue 12 years ago • 3 comments

Mobile browser give access to some useful data as the rotation of the device in the real world (event deviceorientation).

I make a simple experiment with a new control system, MotionControls.js for three.js: https://github.com/jbouny/motioncontrols

A simple demo is: http://jeremybouny.fr/motioncontrols/example/

Simple usage: control = new THREE.MotionControls( camera ); [...] control.update();

The problem is that it is really unstable. Each browser gives data with the same interface, but with inverting angles.

I tried on Android some browser on a Galaxy S3:

  • Firefox stable: angles inversion
  • Firefox beta: works really fine, it already filter data
  • Chrome beta: works with noised data
  • Opera beta: works with noised data

Currently, it's hard to make something really cross browser with same quality. Moreover, data are noised on some browsers. I think i could add a filter as Kalman.

BUT, even if there is a lot of problems. I think it is really cool to control the camera. If you have an android system with Firefox beta, you can try this demo: http://jeremybouny.fr/ocean/demo_mobile/. I am not sure about the good working on others.

So, is it too early to try to integrate an example with this system as it is not really stable (but cool?) and concern a specific usage?

jbouny avatar Feb 24 '14 08:02 jbouny

#4475 ;)

mrdoob avatar Feb 24 '14 17:02 mrdoob

Ahah thanks! I made a fast research, but not sufficient... Nice, i am not alone!

jbouny avatar Feb 24 '14 21:02 jbouny

I like where this is heading regarding 'fixing' the rotation axis orders as screen orientation changes :)

It seems https://github.com/mrdoob/three.js/issues/4475 is producing better results across mobile browsers this stage though. I think it would be worth developing your ideas presented here inside that model.

Also worth noting that there is also a 'devicemotion' event that provides accelerometer data so a better name for this could be 'Orientation'Controls. (I can't wait for 'fusion' controls though! Device Orientation + Motion as a way to solve gimbal lock?).

richtr avatar Feb 25 '14 09:02 richtr