I'm struggling to grasp the concept of local axis rotation in ThreeJS. Despite referencing this Rotate around local axis answer, I can't seem to achieve the desired outcome.
For example, if I create a cylinder and rotate it
const geometry = new THREE.CylinderBufferGeometry( 10, 10, 20 );
geometry.rotateX(Math.PI/2)
How can I proceed to rotate the cylinder along its long axis?
I assumed geometry.rotateY(Math.PI/5)
would suffice, but it seems to be rotating around the global axis instead. I aim to rotate it solely around the local axis for consistency with:
geometry.rotateY(Math.PI/5)
geometry.rotateX(Math.PI/2)
If anyone could shed some light on how to rotate around an object's internal axis, that would be greatly appreciated.
Actual result: https://jsfiddle.net/h20hnn3n/46/
Desired outcome: https://jsfiddle.net/81j6g2ms/1/
In my scenario, I need to rotate around the X axis by a specific angle first, followed by a rotation around the previous Y axis. It would be convenient if I could execute these rotations in sequence.
Edit: I've noticed a discrepancy when rotating the geometry versus a mesh. Shouldn't they produce the same result?
I'm perplexed as to why this doesn't yield identical behavior: https://jsfiddle.net/10L8se71/2/