如何将相机的角度设置为像
isometric projection这样的角度?
解决方法
要获得等轴测图,您可以使用OrthographicCamera.然后,您需要正确设置相机的方向.有两种方法可以做到这一点:
方法1 – 使用camera.lookAt()
var aspect = window.innerWidth / window.innerHeight; var d = 20; camera = new THREE.OrthographicCamera( - d * aspect,d * aspect,d,- d,1,1000 ); camera.position.set( 20,20,20 ); // all components equal camera.lookAt( scene.position ); // or the origin
方法2 – 设置camera.rotation的x分量
camera.position.set( 20,20 ); camera.rotation.order = 'YXZ'; camera.rotation.y = - Math.PI / 4; camera.rotation.x = Math.atan( - 1 / Math.sqrt( 2 ) );
小提琴:http://jsfiddle.net/q3m2kh5q/
three.js r.73