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.
Asked
Active
Viewed 2,896 times
2 Answers
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

Community
- 1
- 1

WestLangley
- 102,557
- 10
- 276
- 276
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/

Alberto Piras
- 517
- 6
- 8