Hi !
I´ve just started working with kinect V2 using this addon :
im tryng to get position z from the joints of the skeleton with no succes, the only thing i got is 0.
this is my code :
ofVec3f normalize(0, 0.5, -0.5);
ofVec3f scale3(ofGetWidth(), ofGetHeight(), 0);
auto bodies = kinect.getBodySource()->getBodies();
const auto & bonesDictionary = ofxKinectForWindows2::Data::Body::getBonesAtlas();
//ofPushMatrix();
//ofTranslate(0, 0, -1500);
for (auto body : bodies) {
if (body.tracked) {
ofPushMatrix();
ofVec3f handLeftPos = (body.joints[JointType_HandLeft].getPosition() + normalize) * scale3;
ofTranslate(handLeftPos.x, handLeftPos.y, handLeftPos.z);
handLeftPos.y = scale3.y - handLeftPos.y;
ofSetColor(0, 0, 255);
ofSphere(0,0, handLeftPos.z);
ofPopMatrix();
ofPushMatrix();
ofVec3f handRightPos = (body.joints[JointType_HandRight].getPosition() + normalize) * scale3;
handRightPos.y = scale3.y - handRightPos.y;
ofTranslate(handRightPos.x, handRightPos.y, handRightPos.z);
ofSetColor(0, 255, 0);
ofSphere(0, 0, handRightPos.z);
ofPopMatrix();
cout << "handLeftPos.z" << handLeftPos.z << endl;
cout << "handRightPos.z" << handRightPos.z << endl;
for (auto bone : bonesDictionary) {
ofVec3f startPos = (body.joints[bone.first].getPosition() + normalize) * scale3;
startPos.y = scale3.y - startPos.y;
//ofSetColor(0);
ofSphere(startPos.x, startPos.y, 10);
ofVec3f endPos = (body.joints[bone.second].getPosition() + normalize) * scale3;
endPos.y = scale3.y - endPos.y;
//ofSetColor(255, 0, 0);
ofSphere(endPos.x, endPos.y, 10);
}
}
}
//ofPopMatrix();