# Moving from OpenNI - how to get a joint transformation

• ### Question

• Hi,

I would prefer to use the official SDK, but it doesn't seem to have a way to get a joint's transformation - something that is very useful when trying to map to a 3D avatar. Does anyone have any suggestions on how to convert the Point that I get from the official SDK to a Transformation?

Thanks,

Marc

Thursday, December 15, 2011 11:21 AM

### All replies

• Identify two adjacent joints and calculate the angle between both vectors.
• Proposed as answer by Tuesday, March 20, 2012 8:22 AM
• Unproposed as answer by Tuesday, March 20, 2012 8:22 AM
Thursday, December 15, 2011 12:02 PM
• Hi Erik,

Do you know of any examples? I understand in principle what you're saying - but can't see in my mind how I would go about coding it. For example, how would I take into account the rotation of the body, and which axis would I be measuring the angle on?

Thanks again

Marc

Thursday, December 15, 2011 12:21 PM
• Assuming the user can't move his left hip independently from his right hip, you can get the y-axis rotation of the body from the left- and right hip joint positions. From the top of my head that would be something like angle = asin((hipleft.z - hipright.z)  / (hipleft.x - hipright.x)).

I realize that some additional calculation is required to get the joint's rotations. If you calculate the angle between two length vector3's ( J - Adj. J1 and J - Adj. J2) the result will of course be the angle in the plane between the three positional vector3's. So you'll need the angle with another reference point to determine the normal vector of the plane. I'd suggest using the kinect plane's normal vector to do this. That would be V(0, 0, 1) if the user is not rotated around his x-axis.

Since the dot-product of the normalized length vectors returns the cosine of the angle, you'll also need to do some extra calculating to work out the "sign" of the angle. This is trivial though.

Good luck!

Erik

• Edited by Thursday, December 15, 2011 9:42 PM added brackets
• Proposed as answer by Sunday, May 6, 2012 12:45 PM
Thursday, December 15, 2011 2:01 PM
• Thanks Erik, I will give that a go.
Monday, December 19, 2011 10:51 AM