Three.JS旋转突起,使得y轴成为z轴 [英] Three.JS rotate projection so that the y axis becomes the z-axis

查看:743
本文介绍了Three.JS旋转突起,使得y轴成为z轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在传统上,在三维凸起,Y轴是重新presents上下轴。我学会了思考的是,与其他发动机,因为该轴是Z轴。我想知道是是否有办法 Three.JS 使Z轴上/下 轴。如果是这样,有什么后果呢?

Traditionally, in 3D projections, the Y-axis is the axis that represents "up and down". I learned to think of it, with other engines, as that axis being the Z-axis. What I was wondering was whether there is a way in Three.JS to make the Z-axis the "up/down" axis. If so, are there any consequences to it?

下面是什么,我希望有一个示意图:

Here is a diagram of what I want:

推荐答案

您可以只改变相机而不是整个坐标系。例如:

You could just change the camera rather than the entire coordinate system. For example:

var WIDTH = 1024;
var HEIGHT = 768;
var VIEW_ANGLE = 45;
var ASPECT = WIDTH / HEIGHT;
var NEAR = 0.1;
var FAR = 10000;
camera = new THREE.PerspectiveCamera(VIEW_ANGLE, ASPECT, NEAR, FAR);
camera.position.z = 300;
camera.up = new THREE.Vector3( 0, 0, 1 );
scene.add(camera);

这改变了最高矢量相机使用Z-UP。

This changes the up vector for the camera to use Z-UP.

修改

要说明的一个例子,这里是你创建稍加修改调用的jsfiddle 注视设置最高矢量后: http://jsfiddle.net/NycWc/1/

To illustrate an example, here's the jsfiddle you created slightly modified to call lookAt after setting the up vector: http://jsfiddle.net/NycWc/1/

这篇关于Three.JS旋转突起,使得y轴成为z轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆