Skip to content

Instantly share code, notes, and snippets.

@UnaNancyOwen
Last active May 29, 2017 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save UnaNancyOwen/5216ff670c522100acf85e0fb314a893 to your computer and use it in GitHub Desktop.
Save UnaNancyOwen/5216ff670c522100acf85e0fb314a893 to your computer and use it in GitHub Desktop.
// Retrieve Body Frame
ComPtr<IBodyFrame> bodyFrame;
const HRESULT ret = bodyFrameReader->AcquireLatestFrame( &bodyFrame );
if( FAILED( ret ) ){
return;
}
// Retrieve Body Data
std::vector<ComPtr<IBody>> bodies( BODY_COUNT );
ERROR_CHECK( bodyFrame->GetAndRefreshBodyData( static_cast<UINT>( bodies.size() ), &bodies[0] ) );
// Retrieve Joints of All Bodies
std::vector<std::vector<Joint>> alljoints( BODY_COUNT, std::vector<Joint>( JointType::JointType_Count ) );
std::for_each( bodies.begin(), bodies.end(),
[&alljoints]( ComPtr<IBody> body ){
std::vector<Joint> joints( JointType::JointType_Count );
ERROR_CHECK( body->GetJoints( static_cast<UINT>( joints.size() ), &joints[0] ) );
alljoints.emplace_back( joints );
/*
Joint joints[JointType::JointType_Count];
ERROR_CHECK( body->GetJoints( JointType::JointType_Count, &joints[0] ) );
alljoints.emplace_back( std::vector<Joint>( &joints[0], &joints[JointType::JointType_Count] ) );
*/
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment