如何在ThreeJS中将网格旋转90度? [英] How can I rotate a mesh by 90 degrees in ThreeJS?

查看:2081
本文介绍了如何在ThreeJS中将网格旋转90度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网格,我想在Three JS中旋转90度。
以下是当前情况的图片:

I have a mesh that I want to rotate by 90 degrees inside Three JS. Here is the image of the current situation:

我希望选定的网格平行旋转到大网格。
我试过像这样旋转矩阵:

I want the selected mesh to be rotated parallelly to the large mesh. I have tried rotating the matrix like this:

matrix =   new THREE.Matrix4().makeRotationX(1.57)

但网格进入奇怪的旋转状态。是否有更简单的方法将其旋转90度?

But the mesh goes into strange rotations. Is there any easier way to rotate it by 90 degrees ?

推荐答案

threejs轮换使用Radians(你可能知道)

The threejs rotation uses Radians (as you might know)

你可以使用这个

mesh.rotation.x = Math.PI / 2;

mesh.rotation.set(new THREE.Vector3( 0, 0, Math.PI / 2));

这篇关于如何在ThreeJS中将网格旋转90度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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