/// <summary> /// transform the skeleton to a JSON object /// </summary> /// <param name="skeleton">the skeleton</param> /// <returns>a skeleton as a JSON</returns> public static JSONSkeleton ToJson(this Skeleton skeleton) { JSONSkeleton jsonSkeleton = new JSONSkeleton { ID = skeleton.TrackingId.ToString(), Joints = new List <JSONJoint>() }; foreach (Joint joint in skeleton.Joints) { jsonSkeleton.Joints.Add(new JSONJoint { Name = joint.JointType.ToString().ToLower(), X = joint.Position.X, Y = joint.Position.Y, Z = joint.Position.Z }); } return(jsonSkeleton); }
/// <summary> /// transform the skeleton to a JSON object /// </summary> /// <param name="skeleton">the skeleton</param> /// <returns>a skeleton as a JSON</returns> public static JSONSkeleton ToJson(this Skeleton skeleton) { JSONSkeleton jsonSkeleton = new JSONSkeleton { ID = skeleton.TrackingId.ToString(), Joints = new List<JSONJoint>() }; foreach (Joint joint in skeleton.Joints) { jsonSkeleton.Joints.Add(new JSONJoint { Name = joint.JointType.ToString().ToLower(), X = joint.Position.X, Y = joint.Position.Y, Z = joint.Position.Z }); } return jsonSkeleton; }