jit.gl rotatexyz bug?

Nicholas Hobson's icon

I'm struggling to understand how to use rotatexyz on a 3d object. I'm not sure if there is a bug, or it is just my limited understanding of how rotatexyz works.

I have an object I'd like to rotate around it's own axes. If I only rotate on an individual axis (x, y or z) it works as I would expect. However, when I start combining different rotations in multiple axes, the results are not what I would expect.

In the attached patch, for example, once I have rotated in z by 90 degrees, rotating in either x or y produce the exact same result. It looks like it's rotating around the world's y-axis, rather than the object's y-axis.

In fact, no matter what rotations are applied, the y-axis rotation always appears to be relative to the world's y-axis rather than object's. Is this a bug?

x-axis rotation appears to work as I would expect. No matter the orientation, rotating around x rotates the object perfectly around its x-axis.

I feel like I'm missing something. I want to apply rotations to the object relative to its own axes.

On a side note, for some reason, if I save and re-load the patch without closing Max, the axes don't automatically appear unless I fully close max and then re-open the patch. Is there a way to ensure the axes are visible every time the patch loads?

Max Patch
Copy patch and select New From Clipboard in Max.

Nicholas Hobson's icon

It's just gimbal lock, switching to using jit.anim.node and using rotate with @turnmode local did the trick.

Max Patch
Copy patch and select New From Clipboard in Max.