Hi, I am trying to rotate images and text based on the rotation of the joints from ofxOpenNi. I was calculating a single axis of rotation, manually from the points but now I need to use 2 axis of rotation and I would like to use the rotation from the joints themselves. Here is my code.
ofMatrix4x4 matriciesLeft[12];
ofTrueTypeFont leftWords[12];
matriciesLeft[i].preMultRotate(user.getJoint(JOINT_RIGHT_HAND).getDerivedOrientation());
ofPushMatrix();
glMultMatrixf(matriciesLeft[i].getPtr());
ofSetColor(255, 255, 255);
leftWords[i].drawStringAsShapes(leftStrings[i], 0, 0);
ofPopMatrix();
When I try this code in another context, using a node I rotate over time and then get the matrix from the node it rotates as I expect. Once the user is detected (this triggers the words to draw) the text flies away from my screen.
I don’t really understand what derived orientation is, maybe that is the problem.
This works a little better for me
ofVec3f vec;
float angle;
ofTranslate(0, 200);
user.getJoint(JOINT_NECK).getDerivedOrientation().getRotate(angle,vec.x,vec.y,vec.z);
ofRotate(angle,vec.x,vec.y,vec.z);
rightWords[i].drawStringAsShapes(rightStrings[i], 0, 0);
But I would like to be able to just get apply the rotation matrix as it seems smoother when I test it away from openNi vs the second method here.
Fred