0
私はカメラを動かしてそれを自分の軸で回転しようとしています。位置の変更はうまくいきますが、回転は機能しません。ここでpositionが3のときに、global.vsグローバルカメラの回転が変化しないのはなぜですか?
は、私のソースの一部です:
var camera = new THREE.PerspectiveCamera(45, window.innerWidth/window.innerHeight, 0.1, 100000);
function camera2() {
this.main = function() {
var camPos = spline.getPoint(camPosIndex/1000);
camera.position.x = camPos.x;
camera.position.y = camPos.y;
camera.position.z = camPos.z;
camera.rotation.z += 0.01; // that doesn't work !!!
camera.updateProjectionMatrix();
camera.lookAt(new THREE.Vector3(0, 0, 20000));
}
}
function renderScene() {
fx[i]["fx"].main(); // call of camera2.main()
requestAnimationFrame(renderScene);
renderer.render(scene, camera);
}
私はrenderScene()
でcamera.rotation.z += 0.01
を呼んでいる、それが働いているが、それは別のカメラを参照するようです(?)。私はグローバルvar camera
を1つしか持たず、位置はmain()
の中で動作しますが、回転はしません。
LookAtの有無にかかわらず動作しません。 – DKT
Shit。 LookAtを呼び出さないとうまくいきます!ありがとう。しかし、なぜ? – DKT
LookAtがカメラの位置と回転のプロパティをオーバーライドしているとします。ありがとうございました! – DKT