与THREE.js的等距相机

Dan*_*iro 16 three.js

如何将摄像机角度设置为等轴测投影

Wes*_*ley 41

要获得等轴测视图,您可以使用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
Run Code Online (Sandbox Code Playgroud)

方法2 - 设置的x分量 camera.rotation

camera.position.set( 20, 20, 20 );
camera.rotation.order = 'YXZ';
camera.rotation.y = - Math.PI / 4;
camera.rotation.x = Math.atan( - 1 / Math.sqrt( 2 ) );
Run Code Online (Sandbox Code Playgroud)

使用正射相机的等轴测图

小提琴:http://jsfiddle.net/q3m2kh5q/

three.js r.73