Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

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

Kinect Sabre

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

Project Information URL: http://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: http://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:

Follow the Discussion

  • Ian WalkerIan2 In geeks we trust ...

    Geek heaven ...

  • dijzondijzon

    hell yeah

  • DevDev

    Cool, a Syntax highlighter will be very cool thanks

    ------------------
    Sorry for my English...

  • Dave Williamsondavewill here birdie birdie, get in my belly!

    I'll have to download this and try it out just to determine if the text reference to "left hand" or the picture shown using "right hand" is the actual output.  Smiley

  • In fact it is effectively the left hand but the picture was inverted Big Smile

  • Allan LindqvistaL_ Kinect ftw

    hotness Wink

  • caseycasey

    i cant get this to run

  • caseycasey

    oops. it keeps saying can not open (.csproj) is not supported by this version of the application. i have Microsoft Visual Studio 2010 Express and whatever they told u to get on the sdk site. any ideas?

  • Greg Duncangduncan411 It's amazing what a professional photographer can do...

    @casey: That error usually means that C# (since you're trying to open a CSProj) is not installed, or installed fully.

    There's a couple different versions of Visual Studio 2010 Express. There's VB, C#, C++, Web and Phone versions (and one does not include the other). Can you confirm that you have the C# version installed (http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-csharp-express)?

  • Andy GoodfellowAndy Goodfellow

    I have VS2010 (Full Version) and I'm getting the same errors. See below. Your thoughts?


    C:\Users\andyg\Repositories\KinectSabre\KinectSabre.Render\KinectSabre.Render\KinectSabre.Render.csproj : error : The project file 'C:\Users\andyg\Repositories\KinectSabre\KinectSabre.Render\KinectSabre.Render\KinectSabre.Render.csproj' cannot be opened.

    The project type is not supported by this installation.

    C:\Users\andyg\Repositories\KinectSabre\KinectSabre.Render\KinectSabre.RenderContent\KinectSabre.RenderContent.contentproj : error : The project file 'C:\Users\andyg\Repositories\KinectSabre\KinectSabre.Render\KinectSabre.RenderContent\KinectSabre.RenderContent.contentproj' cannot be opened.

    The project type is not supported by this installation.

  • Greg Duncangduncan411 It's amazing what a professional photographer can do...

    @Andy Goodfellow: Ah... In looking at the solution, those are XNA based project types. Do you have the XNA Game Studio v4 installed? http://www.microsoft.com/download/en/details.aspx?id=23714 (I didn't think of that in my first response... sorry about that...)

  • Stuck on RenderGames.cs UpdateColorTexture where it can't evaluate colorTexture.Width and colorTexture.Height for the for loop because it is null. Any hints as initiating colorTexture before that for loop so that it is not null?

  • Espionage724Espionage724

    Can someone please upload a pre-compiled folder with the file(s)?

  • Hello, Greg Duncan Have you recorded any videos ?

     

  • Greg Duncangduncan411 It's amazing what a professional photographer can do...

    @uforualways: No, I can't say that I have...

  • nicosamanicosama

    i have a little problem it do not recognize "using KinectSabre.Render"
    have you a solution

    sorry for the english ^^

  • nicosamanicosama

    the error i have is

    The type or namespace name 'Render' does not exist in the namespace 'KinectSabre' (are you missing an assembly reference ?)

  • Clint RutkasClint I'm a "developer"

    @nicosama:I just opened up the project compiled and runs fine.  Do you have XNA installed?

  • caseycasey

    still having the :\Users\andyg\Repositories\KinectSabre\KinectSabre.Render\KinectSabre.Render\KinectSabre.Render.csproj : error : The project file 'C:\Users\andyg\Repositories\KinectSabre\KinectSabre.Render\KinectSabre.Render\KinectSabre.Render.csproj' cannot be opened.

    The project type is not supported by this installation.

    C:\Users\andyg\Repositories\KinectSabre\KinectSabre.Render\KinectSabre.RenderContent\KinectSabre.RenderContent.contentproj : error : The project file 'C:\Users\andyg\Repositories\KinectSabre\KinectSabre.Render\KinectSabre.RenderContent\KinectSabre.RenderContent.contentproj' cannot be opened.

    The project type is not supported by this installation.

    i have xna installed and sq server 2008 and kinect skd.

    this is driving me nuts!

  • Greg Duncangduncan411 It's amazing what a professional photographer can do...

    @casey: As I understand it what happens is that Visual Studio will use ProjectTypeGuids value in the csproj to compare what the project needs against what's on the given machine.

    For KinectSabre.Render.csproj there's two;

    <ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> 

    Here's a good list for the ProjectTypeGuids

    http://www.mztools.com/Articles/2008/MZ2008017.aspx

    Type ProjectTypeGuids for this project are;

    Windows (C#) {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
    XNA (Windows) {6D335F3A-9D43-41b4-9D22-F6F17C4BE596}

    You've already said you have all these installed, so I'm not sure why you can't get this project to load...

    I've seen where someone with a like problem in another solution removed that line from the csprog file to get a project to load. I can't recommend this as it bypasses important system checks, but...

  • Yes, the XNA Game Studio 4 is required to run this sample.

    Another post on gestures:

    http://blogs.msdn.com/b/eternalcoding/archive/2011/07/04/gestures-and-tools-for-kinect.aspx

  • I am trying to run this on a laptop that does not support hidef. I have changed it to reach instead but still getting an error.

    XNA Framework Reach profile requires TextureAddressMode to be Clamp when using texture sizes that are not powers of two.

     

  • ,glenster75 wrote

    Stuck on RenderGames.cs UpdateColorTexture where it can't evaluate colorTexture.Width and colorTexture.Height for the for loop because it is null. Any hints as initiating colorTexture before that for loop so that it is not null?

    Hi, I have the same situation as you. Did you get any solution?

    Please, Help me!!!

  • MiroslavMiroslav

    Same problem here...

  • JudaviJudavi

    OWESOME!! Works great!

  • MohMoh

    Please does anyone know how I can create and navigate an avatar using the Kinect SDK if it has the capability of doing so? Thank you very much in anticipation.

  • ChuckChuck

    I to had the same thing. I kept going through the messages and it would say download this and I would then I would have the failure records of the same contentproj type codes show and I would read on and it would tell you, oh yea, you have to download this and I would download it and again, the same problem. Now I have a hard drive full of crap that doesn't work. Not worth it. Glad I was just trying to play around with it and wasn't nothing serious. It's a beta version I guess. Depends on what connection you have whether you write all the lines in the program as it down loads. Give up myself. Don't need a saber light sword anyway.

  • nigelgosnigelgos

    Won't compile for me :(

    The type or namespace name 'Research' does not exist...

    Sounds like it's to do with the sdk version but I have downloaded and installed the 01 Feb release. I had a beta sdk prior to this.

  • Greg Duncangduncan411 It's amazing what a professional photographer can do...

    @nigelgos:Yep, this was written in the Beta 1 time frame. I know he's got an updated version that should be available online soon, but in the mean time check out, http://robrelyea.wordpress.com/2012/02/01/k4w-code-migration-from-beta2-to-v1-0-managed/, which will help in the migration of code from the Beta to the RTM of the SDK

  • nigelgosnigelgos

    @gduncan411 - Thanks for that. I had a quick play and got rid of alot of the issues but some required a bit more understanding of the code in order to re-jig things. I've given up now. Does anyone have a compiled binary file? I really want to swing a light saber :)

  • Greg Duncangduncan411 It's amazing what a professional photographer can do...

    @nigelgos:Keep an eye on David's blog, http://blogs.msdn.com/b/eternalcoding/. I know he has an updated version and I'm sure they will appear there soon...

  • nigelgosnigelgos

    He posted it up yesterday [8th feb](http://blogs.msdn.com/b/eternalcoding/archive/2012/02/09/kinect-keyboard-simulator-amp-kinect-sabre-for-kinect-for-windows-sdk-1-0.aspx)

    Thanks the pointer.

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.