Please explain to me the difference between mesh.rotateX(0.01) and mesh.rotation.x += 0.01;
My mesh is in origin and i do not see difference
Please explain to me the difference between mesh.rotateX(0.01) and mesh.rotation.x += 0.01;
My mesh is in origin and i do not see difference
you should see a difference when rotation.y and rotation.z are not 0
I’m guessing here:
whereas
mesh.rotateX(0.01), that used simply to rotate for the first nice scene
mesh.rotation.x += 0.01; thats used mostly in animate function to rotate the thing non-stop
There is no difference.
Looking at the source code, Object3D.rotateX()
calls Object3D.rotateOnAxis()
which uses quaternion multiplication to rotate the object around its X axis by the specified amount.
So I’d imagine in most cases mesh.rotateX(0.01) and mesh.rotation.x += 0.01 have the exact same result, though mesh.rotateX might have more predictable results in more complex use cases such as rotating on one axis, then another.
This article explains why using Euler angles (mesh.rotation) can have issues at some angles, using quaternions helps deal with that.
I don’t think that this is true:
mesh.rotateX(0.01)
mesh.rotateX(0.01)
mesh.rotateX(0.01)
mesh.rotateX(0.01)
mesh.rotateX(0.01)
would be the same as
mesh.rotateX(0.05)
The source code though, i think @makc3d is right. It’s always “x axis” it rotates around, i get confused when it comes to eulers.
Object3D.rotate() returns this Object3D and it allows to make a chain of transformations and other operstions with this object. For example
Mesh.rotateX(.1).translateY(10)
yeah , it’s just where to use idea, not a science fact