问题
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();
...
Have you an idea?
Greeting, Johannes
回答1:
I figured it out
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
来源:https://stackoverflow.com/questions/19098775/threejs-reset-camera-position-rotation-when-using-pointerlockcontrols