Kinect 2 skeleton joints (quaternion) rotation

Did anyone ever managed to use in a meaningful way the rotation information (quaternions) out of the skeleton joints?
Is there any patch around where those quaternions do what they are supposed to?


yes i did. at least the head orientation was quite useful to me to check if person looks at a screen.

need to check if i still can find the patch…

check this. only some of the joints contain meaningful rotation info and you can retrieve head rotation via the face node.

kinect_rotations.v4p (15.6 KB)

Joints contain proper rotation information, sometimes joint have also an translate offset in xyz direction, thats why it’s hard to interpreate it. There is old thread with skeleton there is a joregs solution witch had an error in offsets, i have somewhere a fixed unfinished version of retargeting patch, but it’s not around with me.

If it’s for character animation, the Kinect2 quaternions work fine until it comes to the rotation of the extremities. I solved this by calculating my own quaternions from the skeleton POSITIONS. That way i got a whole rigged character properly animated. (There are a few demos around like for Unity or UE4, where i suppose it’s also done this way). The nice thing about this is, that you can simply rig your character with bone orientations according to the v4 coordinate system, which means the y-axis always the up vector, x is always left/right,…
So, if you want to calculate (gimbal lock free) rotations by yourself, AxisAngle (Quaternion Set Vector) is your friend.

QuaternionFromPoints.v4p (7.7 KB)
QuaternionFromPoints(help).v4p (15.1 KB)


tnx to all of your inputs.

@flux I don’t get how to correctly evaluate quaternion orientation of a bone having just the joints position.
using quaternion from points it’s more or less like using the old Cartesian approach, with always one up vector.

what happens to the bones of the legs when joints are vertically aligned?
if the upvector I Y axis, they will constantly flip, since they are aligned with the upvector.

the only way would be to dynamically evaluate the upvector for each bone, depending not only on its joints but on other ones.
shoulder, elbow, wrist
to get the orientation of the bone between shoulder and elbow you do:

  • use quaternionFromPoints module (shoulder and elbow pos as inputs)
  • evaluate upvector using cross product between vector one (shoulder-elbow) and vector two (elbow-wrist).
  • in this case, the evaluated up vector will be valid for both the bones ( shoulder-elbow and elbow-wrist)
    (every bone needs its own rules to define the upvector tho)

is this this what you meant?

found this

joints hierarchy seems relevant.
you need to apply parents transformations before local ones in order to have correct results.
… if i got it correctly…

if the upvector I Y axis, they will constantly flip, since they are aligned with the upvector.

This might be only partially true. If the bone looks in the same direction as the up-vector, you get the identity quaternion, which means that bone flipping won’t occur, in contrast to the case when the bone looks in the exact opposite direction, then you’re completely right.
I don’t have my patch at hand right now, but what i remember is, that according to the T-pose my “up-vector” for e.g. the right arm was (1,0,0) and (-1,0,0) for the left one respectively (but not in the 3D model!). It might not be very likely, that your right arm is perfectly aligned along the negative x-axis, so you can minimize this issue that way. But you’re right, although i didn’t experience it, bone flipping can theoretically occur. And yes, with this method you need to multiply each quaternion by the inverse quaternion of the parent bone as you’ll need relative orientations.
Your approach seems completely plausible to me, except step 1. I might be wrong, but why would you need the quaternion in advance when you calculate it from the direction vectors anyway in step 2?
Btw, the name “QuaternionFromPoints” is a little misleading, I should rather call it “QuaternionFromVectors”…

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.