Hello! I’m having some trouble applying quaternions to a human model in JME. This is the model in the initial position (the camera is oriented looking from a vector 1,1,1 towards the origin):
But if JME uses the same right-hand coordinates system of OpenGL, why a positive rotation around the x-axis make the arm to lift towards the front instead the back?? Shouldn’t the positive rotation be counter-clockwise??
Also because applying the same positive rotation of 90 degrees to the y-axis the model rotate as expected in the counter-clockwise direction.
The rotation of the arm doesn’t depends from the point of view of the user or from where the camera is placed. The direction of the rotation should be referred to the reference system, that in my model I highlighted with the coloured axis. Given that the x-axis is the green one, the rotation of the arm around this axis is clockwise, instead to be counter-clock wise as it should be.
The direction does not depend on the camera, that is correct.
But whether you see it as clockwise or counter clockwise does.
If you flip a (transparent) clock over and look at it from behind, its hands move counter clockwise, even though the direction of the actual rotation did not change.
The way JME defines rotation is “counter clockwise when being viewed from the axis’s point of origin”
Ok, I understand your point. But the right-hand rule tells that looking from the point 1,0,0 towards the origin, the rotation should be counter clockwise. Like this:
Initially, as you said, I thought that could be JME that actually use the counter clockwise direction from the point of view of the origin. But if so, why does this code:
For the y-axis a positive rotation is applied counter clockwise, watching from the up towards the origin. For the x-axis the same positive rotation is applied clockwise, watching from the East towards the origin. As you said, whether I see a rotation as clockwise or counter clockwise depends on the camera or on the point of view of the user, but it should be anyway coherent.
Well, I don’t know if this affects what you expect but remember when looking down the positive Z axis, the X axis is backwards. We usually think of Y up and X right… but in JME that’s only when looking down the negative Z axis.
Anyway, bones are weird because they may have transforms applied higher up that move them in odd orientations. Of course, the models I was using were defined by someone else so maybe a proper hierarchy doesn’t have that issue. For me, when I wanted rotations to be sensible in world space I always had to change the basis.
And in world space, when looking down positive Z, I’d expect a positive rotation around the X-axis to be backwards… like you expect. But honestly, I always find out through trial and error.
Anyway, with a little more tests I’ve seen that only the arms of my model have been affected by this problem. Is I apply the rotation to the torso or the the legs, the body part is rotated correctly. Can anyone explain this behavior? How can the direction of the rotation depend on the part of the model??