使用three.js应用相机位置和旋转

3

在场景中,我有一个物体,使用 PerspectiveCamera 查看。使用 OrbitControls,我可以绕物体移动、旋转和平移等。

我想做的是将物体移动到特定位置,并以特定角度旋转,然后获取相机位置和旋转,之后我会使用这些值来更新相机。问题是 three.js 并没有应用其中一些值。以下是我获取相机位置、旋转和 lookAt 向量的方法:

console.log("Position", camera.position)
console.log("Rotation", camera.rotation)
console.log("World Direction", camera.getWorldDirection())

当我取得向量后,将它们记录下来并按照如下方式应用:
camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000);
camera.rotation.set(-3.14, -0.44, -3.14);
camera.position.set(-1067.29, 34.23, 205.82);
camera.lookAt(0.43, -7.10, 0.90)

但问题在于,如果我使用了 OrbitControls 的 pan 功能,则旋转和位置会改变为其他值。

1个回答

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接