Threejs具有设备方向控制的旋转对象 [英] Threejs Rotating object with device orientation control

查看:41
本文介绍了Threejs具有设备方向控制的旋转对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现类似于 Google 推出的纸板应用示例之一的效果,该示例称为展示".我有一个 3D 对象,我想使用设备方向控制对其进行旋转.现在只使用设备方向控制,我可以查看 3D 对象,但是当我转身时,相机旋转(似乎)导致对象从视野中消失,直到我一直转身回到它所在的位置开始.换句话说,当我环顾四周时,相机似乎在其轴上旋转.我想要的是能够在我转身时旋转物体.

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.

有点像这个例子 http://threejs.org/examples/#misc_controls_orbit 除非我想要使用设备方向控制进行旋转.

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?

感谢您的帮助.

推荐答案

我自己对未来寻求者的问题的答案是替换

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

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

使用您尝试旋转的 3D 对象.

with the 3D object you are trying to rotate.

这篇关于Threejs具有设备方向控制的旋转对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆