public void SensorSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e) { Skeleton[] skeletons = new Skeleton[0]; long frameTimeStamp = 0; using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame()) { if (skeletonFrame != null) { skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength]; skeletonFrame.CopySkeletonDataTo(skeletons); frameTimeStamp = skeletonFrame.Timestamp; } } if (skeletons.Length != 0) { canvas.Children.Clear(); foreach (Skeleton skel in skeletons) { // render clipped edges renderClippedEdges(skel); if (SkeletonTrackingState.Tracked == skel.TrackingState) { // clibrate the bones if not done yet _structuredSkeleton.CliberateSkeleton(skel); // render the skeleton on the canvas addBones(skel); if (!_structuredSkeleton.NeedBoneClibrated()) { this.grid.Background = Brushes.AntiqueWhite; _structuredSkeleton.UpdateJoints(skel); // record motion data to bvh file if (underRecording) { bvhWriter.AppendOneMotionFrame(); } // render bones for debug //addTPose_Debug(); DebugData.UpdateSkeletonForDebug(_structuredSkeleton.hipRoot); addBVHBones_Debug(); } } } } }