在我的 animate() 函数中,我有以下代码:
if (this.controls.forward) {
// move in direction we look at
var cameraDirectionVector = new THREE.Vector3(0, 0, -1);
cameraDirectionVector.applyQuaternion(this.camera.quaternion);
var angle = cameraDirectionVector.angleTo(this.characterMesh.position);
this.characterMesh.translateOnAxis(cameraDirectionVector.cross(this.characterMesh.position), moveDistance);
this.characterMesh.translateZ(-moveDistance);
}
if (this.controls.backward) {
this.characterMesh.translateZ(moveDistance);
}
相机是 characterMesh 的子对象。向前和向后移动完美。但是我想(在飞机上)移动到我实际正在寻找的地方(只是偏航)。我找到了 Unity3D 的代码示例,并尝试将其调整为无效的 three.js。
任何帮助或提示将不胜感激!