I can’t help with Python @haakonflaar, but I’ll try to explain what we have on our side.
If I understand correctly, you want to obtain the 3D positions of each joint based on the root’s position/orientation, the local joints’ orientations, and the length of the bones.
It is important to note that the local rotations provided by the SDK are relative to the T-pose, where bones are assumed to have an identity quaternion as their local rotation when in T-Pose.
You must recursively apply the local orientation and translation provided by the SDK throughout the kinematic chain using the equation
represents the global pose (rotation and translation) of the current joint, is the global pose of the current joint’s parent, and is the local pose provided by the SDK.
The global pose of the root, provided by the SDK, serves as the initialization for the recursion.
is a 4x4 SE(3) matrix, and is the rotation matrix obtained from the quaternion .
The SE(3) matrix is the matrix made of the rotation matrix and the translation matrix, it looks like this:
Also, you could want to check out this topic on StackExchange about applying quaternions to vectors.
By the way, in Unity, you can directly grab the positional data from the animator in the LateUpdate loop, after the engine has done this kind of calculation.
I think that’s all I have about this, I hope it helps a bit.
Jean-Loup