我正试图让相机围绕世界空间的任意轴进行轨道运动。我已经花了这么多时间试图解决这个问题而没有运气。我不想添加像THREE.OrbitControls这样的库来拥有这个功能。谁能告诉我在下面的代码中我做错了什么?
Camera.prototype.orbit = function(axis, spd, pt) {
var axis = axis.normalize(),
currCamQuaternion = new THREE.Quaternion(this.position.x, this.position.y, this.position.z, 0),
rotQuaternion = new THREE.Quaternion();
rotQuaternion.setFromAxisAngle(axis, spd);
var halfCamQuaternion = rotQuaternion.clone().multiply(currCamQuaternion),
fullCamQuaternion = halfCamQuaternion.clone().multiply(rotQuaternion.clone().conjugate());
this.position.copy(new THREE.Vector3(fullCamQuaternion.x, fullCamQuaternion.y, fullCamQuaternion.z));
this.lookAt(pt);
}