mulMatrixByInverse(getJoint(joint.getParentIndex()), bind);
results in:
matrix = parent-inverse-bind * bind.
bind = parent-inverse-bind * parent-bind * bone-local * translate-to-origin * rotation. Note the emphasis.
bind = Identity-matrix * bone-local * translate-to-origin * rotation.
The problem is that "mulMatrixByInverse" function does this :
private void mulMatrixByInverse(Joint ref, Matrix mat) {
if (ref != null) {
mat.matMul(ref.getInverseBindPose());
}
}
Thus the result is matrix = bind * parent-inverse-bind and not matrix = parent-inverse-bind * bind .
We have tried to invert the matrices inside the function above and the result is wrong, the model's leg moves in the wrong way.