Thank you for your help, Walt.
One last question, I have a difficulty using IsInGripInteraction property in your script. Some tutorial tells me I need to create KinectRegion to use IsInGripInteraction. But I want this to be working on windows desktop enviroment, not just in an application with KinectRegion set. Would you please guide me to the way?
Thanks for the great tutorial. I am wondering how we can add Mouse Left Button double Click event, hopely it triggers when right hand is closed. Native MS kinect support "Grip". Would you show me little more tutorial on "how to add more mouse event" to your current tutorial, please?
The code in MainWindow.xaml.cs already contains a method called "CheckForClickHold" which is using a timer to click the left mouse button if the user hovers over a location for a set period of time. If I were you, I would probably write another, similar method called "CheckForGrip" and place the grip checking code in that method. Then I would comment out the CheckForClickHold method call in the SensorSkeletonFrameReady method and substitute a call for your new method, something like:
var leftClick = CheckForGrip(scaledRightHand);
That will cause the SendMouseInput method in the next line of code to send the result of your grip check over to the mouse input handler in Windows, which should give you the effect you desire.
Hope that helps you.
Tobias, Your issue is a common problem with Visual Studio. There are several things that might be causing the problem, none of which are related to the actual project. You might check out this link for some possible solutions. If you can't get it working, you might raise the issue on the Visual Studio forum where others apparently have had this same problem.
I ran into this same exact problem and spent lots of time trying to fix it. The issue was the icon in the XAML.
Simply delete this line and run it.
P.S. Thanks for the code Walt!
So I see that the ScaleTo method in the sample code is based in an extension of the the Joint object - how can I bring this into my own custom application?
Similiarly, with SystemParameters, I can see that it is in System.Windows, but in my own custom project, the only child of System.Windows is Forms, SystemParameters is not to be seen.
Lastly, when I download the sample code, I get a NullPointerException in the xaml when I attempt to run it - why is this?
Thank you for the questions. Let me see if I can answer them for you.
1) The ScaleTo method is included in the Coding4Fun.Kinect.Wpf dll, which is in turn part of the Coding4Fun.Kinect project, which you can find here - http://c4fkinect.codeplex.com.
2) To get SystemParameters, you should be able to reference System.Windows in your own code as I have done in my code with "using System.Windows;" in the source code. You might have to add the reference into your own project if it is not there by default.
3) Lastly, I am not sure where you are getting the null pointer exception, but you might be able to get rid of that by looking at the dependencies in the project, such as having the proper Kinect SDK (1.5), the Kinect Developer Toolkit, or the Coding4Fun packages. If you post some more detail about your error like maybe a call stack or something, I might be able to help you further.
Help us improve MSDN.
Visit our UserVoice Page to submit and vote on ideas!