// draws the skeleton in the given texture private void DrawSkeleton(Texture2D aTexture, ref KinectWrapper.BodyData bodyData) { int jointsCount = KinectWrapper.Constants.JointCount; for (int i = 0; i < jointsCount; i++) { int parent = (int)KinectWrapper.GetParentJoint((KinectWrapper.JointType)i); if (bodyData.joint[i].trackingState == KinectWrapper.TrackingState.Tracked && bodyData.joint[parent].trackingState == KinectWrapper.TrackingState.Tracked) { Vector2 posParent = KinectWrapper.GetKinectPointDepthCoords(bodyData.joint[parent].kinectPos); Vector2 posJoint = KinectWrapper.GetKinectPointDepthCoords(bodyData.joint[i].kinectPos); // posParent.y = KinectWrapper.Constants.ImageHeight - posParent.y - 1; // posJoint.y = KinectWrapper.Constants.ImageHeight - posJoint.y - 1; // posParent.x = KinectWrapper.Constants.ImageWidth - posParent.x - 1; // posJoint.x = KinectWrapper.Constants.ImageWidth - posJoint.x - 1; //Color lineColor = playerJointsTracked[i] && playerJointsTracked[parent] ? Color.red : Color.yellow; DrawLine(aTexture, (int)posParent.x, (int)posParent.y, (int)posJoint.x, (int)posJoint.y, Color.yellow); } } //aTexture.Apply(); }