title: Draw the closest Bone (Shoulder - Head) of 2 tracking skeletons Kinect SDK v1.6
body: <p>I'm looking a solution to draw the bone of the closest skeleton. I wrote code to draw the first tracking skeleton's bone. If the second person will closer than first I want to draw bone of second skeleton. Maybe somebody have any idea how to do it? </p>
  
  <pre><code>void sensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
  {
      using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
      {
          // check for frame drop.
          if (skeletonFrame == null)
          {
              return;
          }
          // copy the frame data in to the collection
          skeletonFrame.CopySkeletonDataTo(totalSkeleton);
  
          // get the first Tracked skeleton
          skeleton = (from trackskeleton in totalSkeleton
                                where trackskeleton.TrackingState == SkeletonTrackingState.Tracked
                                select trackskeleton).FirstOrDefault();
  
  
          if (skeleton != null)
          {
              if (skeleton.Joints[JointType.ShoulderCenter].TrackingState == JointTrackingState.Tracked &amp;&amp; skeleton.Joints[JointType.Head].TrackingState == JointTrackingState.Tracked)
              {
                  myCanvas.Children.Clear();
                  this.DrawHead();
              }
          }
      }
  }
  
  // Draws the head.
  private void DrawHead()
  {
      if (skeleton != null)
      {
          drawBone(skeleton.Joints[JointType.ShoulderCenter], skeleton.Joints[JointType.Head]);
      }
  }
  
  
  // Draws the bone.
  void drawBone(Joint trackedJoint1, Joint trackedJoint2)
  {
      Line skeletonBone = new Line();
      skeletonBone.Stroke = Brushes.Black;
      skeletonBone.StrokeThickness = 3;
  
      Point joint1 = this.ScalePosition(trackedJoint1.Position);
      skeletonBone.X1 = joint1.X;
      skeletonBone.Y1 = joint1.Y;
  
      Point joint2 = this.ScalePosition(trackedJoint2.Position);
      skeletonBone.X2 = joint2.X;
      skeletonBone.Y2 = joint2.Y;
  
      myCanvas.Children.Add(skeletonBone);
  }
  
  /// &lt;summary&gt;
  /// Scales the position.
  /// &lt;/summary&gt;
  /// &lt;param name="skeletonPoint"&gt;The skeltonpoint.&lt;/param&gt;
  /// &lt;returns&gt;&lt;/returns&gt;
  private Point ScalePosition(SkeletonPoint skeletonPoint)
  {
      // return the depth points from the skeleton point
      DepthImagePoint depthPoint = this.sensor.CoordinateMapper.MapSkeletonPointToDepthPoint(skeletonPoint, DepthImageFormat.Resolution640x480Fps30);
      return new Point(depthPoint.X, depthPoint.Y);
  }
  </code></pre>