Of course our first Kinect for Windows SDK Project has to involve a Light Saber!

Description

Kinect Sabre

Augmented reality WPF C# application (with XNA) that adds a Sith Light Saber to your left hand.

Project Information URL: https://blogs.msdn.com/b/eternalcoding/archive/2011/06/13/unleash-the-power-of-kinect-for-windows-sdk.aspx
Update for the Kinect for Windows SDK v1: https://blogs.msdn.com/b/eternalcoding/archive/2012/02/09/kinect-keyboard-simulator-amp-kinect-sabre-for-kinect-for-windows-sdk-1-0.aspx

Project Download URL: http://www.catuhe.com/msdn/Kinect Sabre.zip (v1 Compatible version: http://www.catuhe.com/msdn/kinecttools.zip)

Kinect Sabre Screenshot

image

Code Snip:

void kinectRuntime_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
 {
     SkeletonFrame skeletonFrame = e.SkeletonFrame;

     bool player1 = true;

     foreach (SkeletonData data in skeletonFrame.Skeletons)
     {
         if (data.TrackingState == SkeletonTrackingState.Tracked)
         {
             foreach (Joint joint in data.Joints)
             {
                 if (joint.Position.W < 0.8f)
                     continue;
                 switch (joint.ID)
                 {
                     case JointID.HandLeft:
                         if (player1)
                             game.P1LeftHandPosition = joint.Position.ToVector3();
                         else
 game.P2LeftHandPosition = joint.Position.ToVector3();
                         break;
                     case JointID.HandRight:
                         if (player1)
                             game.P1RightHandPosition = joint.Position.ToVector3();
                         else
 game.P2RightHandPosition = joint.Position.ToVector3();
                         break;
                     case JointID.WristLeft:
                         if (player1)
                             game.P1LeftWristPosition = joint.Position.ToVector3();
                         else
 game.P2LeftWristPosition = joint.Position.ToVector3();
                         break;
                     case JointID.ElbowLeft:
                         if (player1)
                             game.P1LeftElbowPosition = joint.Position.ToVector3();
                         else
 game.P2LeftElbowPosition = joint.Position.ToVector3();
                         break;
                 }
             }

             if (player1)
             {
                 player1 = false;
                 game.P1IsActive = true;
             }
             else
 {
                 game.P2IsActive = true;
                 return;
             }
         }
     }

     if (player1)
         game.P1IsActive = false;

     game.P2IsActive = false;
 }

Contact Information:

Tag:

Kinect