none
How to get the 3d coordinate of Joint? RRS feed

  • Question

  • I want to get the 3d coordinate of Joint and show the skeleton in XNA.

    Does somebody know how to get the 3d coordinate of Joint?

     


    akira32 編程之家 Yahoo http://tw.myblog.yahoo.com/akira32-akira32
    Tuesday, June 21, 2011 4:09 PM

Answers

  • Hi akira32,

    The SkeletonFrame.Skeletons.First().Joints[JointID.HandRight].Position is a Vector object from the Microsoft.Research.Kinect.Nui namespace.

    Here I created an extension method which converts a Joint object to a System.Windows.Media.Media3D.Vector3D  (here you could return your XNA Vector3D object or alike):

    public static class JointExtension
      {
        public static Vector3D ToVector3D(this Joint joint, int precision)
        {
          return new Vector3D
          {
            X = Math.Round(joint.Position.X, precision),
            Y = Math.Round(joint.Position.Y, precision),
            Z = Math.Round(joint.Position.Z, precision)
          };
        }
      }
    

    Hope this helps,

    Michael



     

    • Marked as answer by akira32 Thursday, June 23, 2011 12:47 PM
    Tuesday, June 21, 2011 4:23 PM