threejs-使用PointerLockControls时重置相机位置/旋转 [英] threejs - Reset camera position/rotation when using PointerLockControls

查看:185
本文介绍了threejs-使用PointerLockControls时重置相机位置/旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用PointerLockControls时,我想重置位置和旋转.目前,我使用

well i wants to reset the position and the rotation, when i am using the PointerLockControls. Currently i use

controls.getObject().position.set( -30, 10, 80 );
controls.getObject().position.y = 10; 

该职位.但是我该如何重置轮播?

for the position. But how can i reset the rotation?

我尝试了其他类似的事情:

I tried different things like:

camera.lookAt(new THREE.Vector3(1,0,0));
camera.rotation.x = - Math.PI / 2;
controls.getObject().rotation.x = 0;
controls.getObject().rotation.y = 0;
controls.updateProjectionMatrix();
...

你有个主意吗?

问候,约翰内斯

推荐答案

我知道了

controls.getObject().rotation.y = 0; // Rotates Yaw Object
controls.getObject().children[0].rotation.x = 0; // Rotates the Pitch Object

现在,相机正朝原始方向看!

Now, the Camera is looking in the original direction!

three.js r.62

three.js r.62

这篇关于threejs-使用PointerLockControls时重置相机位置/旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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