How can I rotate a mesh by 90 degrees in ThreeJS?

Zaay picture Zaay · Apr 28, 2015 · Viewed 82.5k times · Source

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

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)

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

Answer

Absulit picture Absulit · May 10, 2015

The threejs rotation uses Radians (as you might know)

you can use this

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

or

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