Object node displacement when rotating in one axis

Hello guys,

I trying to rotating one Bone of my .glb file with useGLTF of drei dependency in x axis, but i got weird displacement only in that Bone

Peek 08-05-2023 12-08

as you can see in gif, the part is rotating in upper part but in lower one is rotating like backward, i don’t know how to explain haha

I created this model in Blender and everything works normal in there:

image

I created a much simpler code here: Embed - CodeSandbox

got same result with this code (index.js:10):

nodes["dorse_cover"].rotation.x = Math.PI

Thanks for the help!

Resolved with quaternion changes, with this code:

const currentRotation = nodes["dorse_cover"].quaternion.clone();
const rotationChange = new THREE.Quaternion().setFromEuler(new THREE.Euler(Math.PI / 2, 0, 0));
nodes["dorse_cover"].quaternion.multiplyQuaternions(currentRotation, rotationChange);

For someone else, don’t forget quaternions haha =D

1 Like