none
Avateering in c++? RRS feed

  • Question

  • hi msn guys,

    is there a chance to get Avateering  example in c++?

    if not, can some one give me a commented code piece  how to get rotations of a bone in simple variables, like left_arm_rot_x, eft_arm_rot_y, eft_arm_rot_z.

    thanks in advance

    Thursday, May 24, 2012 9:04 PM

All replies

  • The C++ API for this is NuiSkeletonCalculateBoneOrientations.You pass it a skeleton and an array of NUI_SKELETON_BONE_ORIENTATION, and it fills in the array.

    The rotations for each bone provided in two different frames of reference: hierarchical (relative to the "parent" bone in the skeleton), and absolute (relative to the camera). Each of these rotations is expressed in two representations: a 4x4 rotation matrix, and a quaternion. Bones are indexed by the joint at the end of the bone that is "furthest" from the center hip joint. For example, to get the bone for the left upper arm, use the index of the left elbow.

    NUI_SKELETON_BONE_ORIENTATION boneOrientations[NUI_SKELETON_POSITION_COUNT];
    NuiSkeletonCalculateBoneOrientations(&skeletonData, &boneOrientations);
    NUI_SKELETON_BONE_ORIENTATION& leftUpperArm = boneOrientations[NUI_SKELETON_POSITION_ELBOW_LEFT];

    For the rotation of the upper left arm, you can access the rotation info using one of the following expressions:

    leftUpperArm.hierarchicalRotation.rotationMatrix
    leftUpperArm.hierarchicalRotation.rotationQuaternion
    leftUpperArm.absoluteRotation.rotationMatrix
    leftUpperArm.absoluteRotation.rotationQuaternion

    John
    K4W Dev


    Thursday, May 24, 2012 10:58 PM
  • hallo and sorry for probably dump question , but in the line

    NuiSkeletonCalculateBoneOrientations(&skeletonData, &boneOrientations);

    i get :

    skeletonbasics.cpp(291): error C2065: 'skeletonData' : undeclared identifier

    what kind of vatible is it and from where does it get its data?

    pls. a code if possible. it will be a very very big help

    thanks in advance

    Friday, May 25, 2012 9:29 PM
  • Based on the documentation, this is skeleton data you get from the sensor.

    NuiSkeletonCalculateBoneOrientations
    http://msdn.microsoft.com/en-us/library/nuiskeleton.nuiskeletoncalculateboneorientations
    pSkeletonData
    Type: NUI_SKELETON_DATA
    [in] Pointer to the skeleton data to calculate bone orientations for.

    NUI_SKELETON_DATA
    http://msdn.microsoft.com/en-us/library/nuiskeleton.nui_skeleton_data.aspx

    For code on how to get a populated NUI_SKELETON_DATA, have a look at the SkeltalViewer sample. In the CSkeletalViewerApp::Nui_GotSkeletonAlert( ) function, from the SkeletonFrame, this contains the SkeletonData array.

    Friday, May 25, 2012 10:17 PM
  • Hi John, 

    So I am also trying to access the bone rotation data, however I am not drawing anything, I just need raw data values.  When I take the code you posted and put it into my code, it doesn't complain.  Everything matches up except one problem, when I print out to the dialog box, the parameter name shows up, but the value just stays at 0.0 (it flickers between -0.0 and 0.0).  Do you know why it is only displaying 0.0 as the data value?  

    Thanks 

    Monday, June 11, 2012 2:58 PM