void Update () {
/*Get Read Skeletal Data and Apply it to Cubes*/
//if we have our data reader
if ( reader != null )
{
//Get the latest frame data
var frame = reader.AcquireLatestFrame();
if( frame != null )
{
//We have the last frame's data
//Setup data if we're null
if( data == null )
{
/*
Create an array of body data with a length of how many bodies are on the screen.
We'll always acces data[0] because we only have one person with the rift.
Maybe in the future we could implement other people being able to enter your virtual world but they wouldn't be wearing the rift.
*/
data = new Body[sensor.BodyFrameSource.BodyCount];
}
//Get and refresh data from the reader
frame.GetAndRefreshBodyData(data);
frame.Dispose();
frame = null;
}
}
}