I can not rotate object around it local space

Hello, guys. I’m a beginner on three.js. A Local Space problem confused me several days.
I have a glb in Blender, its a WindGenerator, and the three Blades lay on axis Z of its own local axis:



When I want to rotate them around their local Z axis, I try all three axis: rotate.X(), rotate.Y(), rotate.Z(), but all goes a mass like:

I think the blades do not rotate around it own local axis, but how to?

Merge rotating object into single object

I think the thread starter wants to animate the pitch of each individual blade (local, blue z-axis), not the whole rotor as such.
.

Apparently you were trying to rotate about the “blue” axis, but the blade rotated about the “green” axis. It looks like your coordinate system got flipped. As a pragmatic approach, there are only three possible axes of (local) rotation. I would try each of them and one should do the trick :wink:

Understanding why and how the coordinate system got flipped requires disclosure of the way the mesh got created, imported, translated and rotated to produce the screenshots you provided.

I cant see. But also maybe need translate pivot.

Hello vielzutun, thank you for your reply. And my images do not show the whole view of How blades rotates and its my fault, I wanna say that the three blades not only rotate around the green axis, but also in blue and red I think - its a mass:



I already tried all three method: rotateX() rotateY() and rotateZ(), and RotateZ() make them roate aroudn the green axis, but rotateX() and rotateY() just make them rotate strangrly. All can I guess is that the local axis of my object disappear and all of the use the world axis as theri local.

@Mugen87 Hi, Mugen. Will threejs save all the local axis of imported .glb models? I guess it doesn’t from my own experience.

Maybe need create Object3d, add blade to him.
Then you can rotate Object3d to one axis and rotate blade to another axis.

can I set the axis of object3d? not same as the world axis?

If object3d without parent, then his local rotation = world rotation.

thank you chaser!
I think I nearly got it. Do you mean that if I create a Group and rotate it, then add a Object3d as child, the local axis of Object3D is the rotated world axis, am I right?

I think world axis of object3d will be: group.rotationMatrix*object3d.rotationMatrix.
I still have not best skill in axis math

It seems you model has different geometries for each blade, that is each blade geometry was copied from the original bleade geometry and then transformed. In the blander you can share a source geometry with several objects, in this case the transforms will applied to the whole objects, not to their geometries. And this approach would also reduce the glb size.

thank you trueshko, do you mean that when I import glb to threejs scene, all the rotation information of their local axis are gone?Am I right?
Thank you again!

Thank you, I’ll try tomorrow and let you know!