As a last recipe of this chapter, we will write a working example for using
nite::HandTracker. In this recipe, we will show you how to control the position of the mouse cursor using the NiTE hand tracker feature and how to simulate a click event.
We are going to use the Hand Raise gesture for the tracking of hands and the Click (push) gesture for the mouse click. Also, because of the low resolution of the depth output compared to the resolution of the monitor, which results in low accuracy of the hand tracker, we decided to move the mouse depending on its distance with the starting point. This is similar to how you control your mouse with a joystick.
Create a project in Visual Studio and prepare it for working with OpenNI and NiTE using the Create a project in Visual Studio 2010 recipe in Chapter 2, OpenNI and C++.