難說不看你的代碼,但這裏是一個樣本做你的描述,這也與鍵x,y和z中的一個對象調用的lookAt ...
http://jsfiddle.net/vn4t6o6u/1/
var camera, scene, renderer, geometry, material, mesh;
init();
animate();
function init() {
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(50, window.innerWidth/window.innerHeight, 1, 10000);
// Place camera on x axis
scene.add(camera);
camera.position.set(-6,-6,30);
camera.up = new THREE.Vector3(0,0,1);
camera.lookAt({x:0,y:0,z:0});
setTimeout(function(){
camera.position.set(14,-6,30);
camera.lookAt({x:8,y:0,z:0});
}, 1000)
setTimeout(function(){
camera.position.set(-6,14,30);
camera.lookAt({x:0,y:8,z:0});
}, 2000)
setTimeout(function(){
camera.position.set(14,14,30);
camera.lookAt({x:8,y:8,z:0});
}, 3000)
geometry1 = new THREE.CubeGeometry(2, 2, 2);
geometry2 = new THREE.CubeGeometry(2, 2, 2);
geometry3 = new THREE.CubeGeometry(2, 2, 2);
geometry4 = new THREE.CubeGeometry(2, 2, 2);
material1 = new THREE.MeshLambertMaterial({color: 0xff0000});
material2 = new THREE.MeshLambertMaterial({color: 0x00ff00});
material3 = new THREE.MeshLambertMaterial({color: 0x0000ff});
material4 = new THREE.MeshLambertMaterial({color: 0x00ffff});
mesh1 = new THREE.Mesh(geometry1, material1);
mesh2 = new THREE.Mesh(geometry2, material2);
mesh3 = new THREE.Mesh(geometry3, material3);
mesh4 = new THREE.Mesh(geometry4, material4);
mesh1.position.set(0, 0, 0);
mesh2.position.set(8, 0, 0);
mesh3.position.set(0, 8, 0);
mesh4.position.set(8, 8, 0);
scene.add(mesh1);
scene.add(mesh2);
scene.add(mesh3);
scene.add(mesh4);
renderer = new THREE.CanvasRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
}
function animate() {
requestAnimationFrame(animate);
render();
}
function render() {
renderer.render(scene, camera);
}
相機的向上向量是什麼? – Devz
'camera.position.set(14,14,30)'<〜第三參數,所以30 –
我還是不明白。另外,我不這麼認爲,但是這是一個問題,我的地圖在X軸和Z軸上? – Devz