Step 1: Creatingthe basic objects
1.Update the scene
1. Adding the basic objects, thefirst of which is the OpenNISettingsPrefab.
2. Play the game: Press play andlook at the results. Nothing much is seen in the game window (only the depthand radar viewers) but various messages appearin the console.
InNIContext:Init(Logger (NIEventLogger)) InOpenNIContext.InitContext with logger=Logger (NIEventLogger) query=Query(NIQuery) Creatingtype=Depth InNIUserAndSkeleton:Init(Logger (NIEventLogger)) initializingwith context Creatingtype=User
注,特别重要,那些程序跑起来,kinect传感器灯不亮的,大都是因为这个原因: If any error messages appear,specifically exceptions or "contextinvalid" messages, this usually means that OpenNI framework, an OpenNIcompliant middleware (e.g. NITE) or the sensor drivers are either not installedor an old version of them is installed. In this situation itis best toreinstall them (see thereadme.rtf file andBeforeyou Start for more information).
2.Look at what the sensor sees in the Depth Viewer
The NIDepthViewer shows thedepth image in the upper right corner of the screen. We can configure theNIDepthViewer in a number of ways
3.Find the users in the Radar Viewer
When a user is just detected,they are considered uncalibrated and are in the uncalibratedcolor (red by default). When they are selected they become calibratingwhich prepares them for tracking (orange by default) and after a short time become calibrated (yellow by default). Theybecome tracking (green by default) when theskeleton is actually tracked and the user controls the input.
Step 2: Add theskeleton and user selection
1.Add the skeleton model
The goal of this tutorial is tocontrol a model so the first step is to add a model to control. To do this,drag the ConstructionWorkerPrefab from the samples prefabs into the scene.
2.Add a User selection method
Defining the user selection is based on thecapabilities provided by the Playermanagement and user selection module. For the purpose of the firsttutorial, we will assume a simple user selection scheme: the user closest to the sensor is the player.
Create a new,empty game object and rename it Player Manager. Drag the NIPlayerManagerCOMSelectionscript to it.
3.Play the game
Press play and stand in front of the sensor, move around and see howthe skeleton mimics your movements.
未完,待续....
转自http://blog.csdn.net/tanmengwen/article/details/7980458