Search code examples
c#visual-studiokinectkinect-sdk

Get a Kinect JointType by its ID number instead of its name


Is there anyway to retrieve a "joint type" by its value, instead of by its name?

For example, instead of (joints[JointType.ShoulderRight]);, we write (joints[8]);.

According to JointType Enumeration, when I do the latter, it gives me the following error

Cannot convert from 'int' to 'Microsoft.Kinect.JointType'


Solution

  • This is the way I use in my sources.

    You just need to do a cast :

    JointType myJoint;
    myJoint = (JointType)8;
    

    after that you can write:

    (joints[myJoint]);