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

查看:75
本文介绍了如何在 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 旋转使用弧度(你可能知道)

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天全站免登陆