I'm trying to create the simplest animation scenario, 12 vertices and 2 bones.
Both bones has a 4x4 matrix. When both are set to "Identity", the model looks correct, like in the picture above (default pose).
When I rotate the root joint, the whole mesh rotates, as expected (child joint rotates with root joint, child joint matrix is pre-multiplied by the root joint's matrix).
However, when I rotate the child joint only, it seems like the vertices it affects rotate around the root joint's origin, effectively stretching the vertices - instead of rotating around the child joint's origin.
So the question is, what would be the correct matrices for this basic example?
Identity matrices for the joints:
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
Joint transforms are calculated as:
Joint 0 matrix = Joint 0 matrix; Joint 1 matrix = Joint 0 matrix * Joint 1 matrix;
When I store positional data in the Child joint, Row 4 (0, 2, 0, 1) - the vertices affected by it are stretched in the Y direction.