threeJS
[threeJS] 카메라 위치잡기
몽쯔
2021. 9. 6. 18:07
지도형3d였고 구석탱이의 시야를 처음 시작으로 잡아야했다
camera.position은 x, y, z순으로 좌우회전, 위아래, 앞뒤(줌)인것같다.
즉, 카메라가 아예 다름 지점을 잡을 순 없다.
그때 사용하는 속성이 target이다
근데 아무리 숫자를 돌려봐도 내가 원하는 대로 가지않았다.
camera = new THREE.PerspectiveCamera(1, window.innerWidth / window.innerHeight, 1, 1000);
camera.position.set(60, 61, 145);
MapControls = new THREE.MapControls( camera, mRenderer.domElement );
MapControls.target = new THREE.Vector3(60, 31, 97);
animate(){
mOrbitControls.update();
console.log(camera.position)
console.log(MapControls.target)
console.log('------------')
}
그래서 사용한게 animate함수안에 콘솔을 넣어 위치까지 이동 후에 그 위치를 적용했다.