Categories
JavaScript Answers

How to rotate a mesh by 90 degrees in Three.js and JavaScript?

Spread the love

Sometimes, we want to rotate a mesh by 90 degrees in Three.js and JavaScript.

In this article, we’ll look at how to rotate a mesh by 90 degrees in Three.js and JavaScript.

How to rotate a mesh by 90 degrees in Three.js and JavaScript?

To rotate a mesh by 90 degrees in Three.js and JavaScript, we set the rotation.x property of the mesh.

For instance, we write

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

to rotate the mesh by 90 degrees, which is Math.PI / 2 radians.

Conclusion

To rotate a mesh by 90 degrees in Three.js and JavaScript, we set the rotation.x property of the mesh.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *