Hi all,
I’m trying to rotate a joint around the Vector3.UNIT_Y axis. However, the result does not correspond to my expectations, and I cannot seem to get it right.
Transform transform = selectedJoint.getModelTransform().clone()
.combineWithParent(skinningControl.getSpatial().getWorldTransform());
arrowX.setLocalTranslation(transform.getTranslation());
arrowX.setLocalRotation(transform.getRotation());
arrowY.setLocalTranslation(transform.getTranslation());
arrowY.setLocalRotation(transform.getRotation());
arrowZ.setLocalTranslation(transform.getTranslation());
arrowZ.setLocalRotation(transform.getRotation());
Quaternion newRotation = new Quaternion().fromAngleAxis(1f * tpf, Vector3f.UNIT_Y).mult(selectedJoint.getLocalRotation());
selectedJoint.setLocalRotation(newRotation);
Initial joint transform:
Which is a bit weird imho, as the joint’s ‘forward direction’ is not the Z-axis, but the X-axis. Is the mistake that I made coming from wrongly importing from Blender using GLTF? However, I would still expect if I rotate the joint using the above code, it would rotate around world Y axis .
For further debugging purposes:
INFO: Hardware skinning engaged for Armature (Node)
-----------------------
Selected Joint : L Elbow02 in armature Armature_Armature
Root Bone : false
-----------------------
Local translation: (113.12236, -0.06864291, -8.303824)
Local rotation: (0.0, 0.8509035, 0.0, 0.52532196)
Local scale: (1.0, 0.9999999, 1.0)
---
Model translation: (181.49194, 181.21202, -71.80898)
Model rotation: (0.40202725, -0.57666767, -0.5766674, -0.41627333)
Model scale: (0.9999994, 0.9999997, 0.9999981)
---
Bind inverse Transform:
Matrix4f
[
-33.018204 1.6428379 -94.37752 -10.823269
-94.377495 1.165594 33.03866 192.89973
1.6428365 99.97969 1.1656089 -183.3205
0.0 0.0 0.0 1.0
]