Threejs Rotating object with device orientation control

☆樱花仙子☆ 提交于 2019-12-12 08:09:31

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/26081699/threejs-rotating-object-with-device-orientation-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!