5

I am trying to achieve an effect similar to one of the cardboard app examples that Google has put out with their cardboard app called the 'exhibit'. I have a 3D object that I want to rotate using device orientation control. Right now with just the device orientation control, I can view the 3D object but when I turn around, the camera rotates (it seems) causing the object to fall out of view until I turn all the way back around to where it was in the beginning. In other words the camera seems to rotate in its axis as I look around. What I want is to be able to rotate the object as I turn around.

Kinda like this example http://threejs.org/examples/#misc_controls_orbit except I want to rotate using device orientation control.

Any idea how I can incorporate this feature?

Thank you for your assistance.

sandav
  • 323
  • 1
  • 4
  • 11
  • 2
    You should be able to do what you want by modifying http://threejs.org/examples/misc_controls_deviceorientation.html to control the box mesh, instead of the camera. – WestLangley Sep 28 '14 at 06:59
  • WestLangley, I followed your suggestion and took a guess to replace "camera" in "controls = new THREE.DeviceOrientationControls(camera, true);" with my 3D object and it worked! This is just amazing. Thank you for your basic push to reconsider the device orientation example. I had seen that example before but struggled to understand how it could be manipulated to get what I wanted partly because of documentation still under construction I believe. Anyway, thank you for your help! – sandav Sep 28 '14 at 18:31
  • I have a question regarding this. The 3d object starts rotating but ina very inintuitive way,do you know what I mean? Do you know a way to make it rotate a the same way as the vr.chromeexperiments.com does in one of the examples? Specifically the one that has a sphere in the middle. – Alvaro Sep 19 '15 at 06:48

1 Answers1

7

The answer to my own question for future seekers is to replace camera in

controls = new THREE.DeviceOrientationControls(camera, true);

with the 3D object you are trying to rotate.

Sven
  • 1,450
  • 3
  • 33
  • 58
sandav
  • 323
  • 1
  • 4
  • 11