我正在为Three.JS场景使用Combined Camera库,并希望在切换时为每个模式设置(重置)预定义参数。
function changeCameraMode(mode_){
var s = "first person";
if(mode_) { s = "birds view"; }
//false: first view, true: bird's eye
console.log("mode: " + s);
if(mode_) { camera.toOrthographic();
camera.cameraO.position = cameraSettings.orpho.position;
camera.cameraO.rotation.onChangeCallback._x = cameraSettings.orpho.rotation.x;
camera.cameraO.rotation.onChangeCallback._y = cameraSettings.orpho.rotation.y;
camera.cameraO.rotation.onChangeCallback._z = cameraSettings.orpho.rotation.z;
camera.cameraO.top = cameraSettings.orpho.top;
camera.cameraO.left = cameraSettings.orpho.left;
camera.cameraO.bottom = cameraSettings.orpho.bottom;
camera.cameraO.right = cameraSettings.orpho.right;
camera.quaternion._x = 0.17446644315139806;
camera.quaternion._y = 0.40250876457862955;
camera.quaternion._z = 0.07844478023909554;
camera.quaternion._w = 0.8952064404955571;
camera.rotation.x = cameraSettings.orpho.rotation.x;
camera.rotation.y = cameraSettings.orpho.rotation.y;
camera.rotation.z = cameraSettings.orpho.rotation.z;
camera.position = cameraSettings.orpho.position;
camera.updateProjectionMatrix();
}
else { camera.toPerspective(); }
}
我玩过几乎所有变量(见上文),但没有真正发生过。 有什么想法吗?
答案 0 :(得分:0)
我已将它与FirstPersonControl.js一起使用,实际上我要做的就是:
controls.lat = value0_;
controls.lon = value1_;
controls.phi = value2_;
controls.theta = value3_;
camera.lookAt(controls.target);