1

I'm trying to rotate object around it's own axis, but nothing want to work. I tried all of functions from documentation, Euler's one, etc. But it just don't want to rotate at all.

2 Answers 2

0

You can rotate an object on its own (local) axis by using a pattern like this one:

var axis = new THREE.Vector3( x, y, z ).normalize(); // create once and reuse it

object.rotateOnAxis( axis, radians );

Make sure the axis has length 1.

Additional convenience methods are

object.rotateX( radians );
object.rotateY( radians );
object.rotateZ( radians );

If you want to rotate the object around a world axis, see this answer.

three.js r.85

Sign up to request clarification or add additional context in comments.

Comments

0

Maybe I can help you: You can rotate an object independently from the rest of the scene using this library https://github.com/albertopiras/threeJS-object-controls.

var controls = new THREE.ObjectControls(camera, renderer.domElement, yourMesh);

here a live demo https://albertopiras.github.io/threeJS-object-controls/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.