I just back to the project after a while.
May I know how do you set-up the matrix from the openNI orientation to irrlicht.
I obtain the joint orientation in this way. My model is created by Blender, when import to Irrlicht, only the y is inverse with the Kinect coordinate system. So that's the reason for the -.
Code: Select all
mat.pointer()[0] = -jointOrientation.orientation.elements[0];
mat.pointer()[1] = jointOrientation.orientation.elements[3];
mat.pointer()[2] = jointOrientation.orientation.elements[6];
mat.pointer()[3] = 0;
mat.pointer()[4] = jointOrientation.orientation.elements[1];
mat.pointer()[5] = jointOrientation.orientation.elements[4];
mat.pointer()[6] = jointOrientation.orientation.elements[7];
mat.pointer()[7] = 0;
mat.pointer()[8] = jointOrientation.orientation.elements[2];
mat.pointer()[9] = jointOrientation.orientation.elements[5];
mat.pointer()[10] =-jointOrientation.orientation.elements[8];
mat.pointer()[11] = 0;
mat.pointer()[12] = 0;
mat.pointer()[13] = 0;
mat.pointer()[14] = 0;
mat.pointer()[15] = 1;
Code: Select all
matrix4 lower = kinect.getSkeletonOrientation(XN_SKEL_LEFT_ELBOW);
matrix4 upper = kinect.getSkeletonOrientation(XN_SKEL_LEFT_SHOULDER);
upper.makeInverse();
matrix4 localRot = lower*upper;
vector3df rot = localRot.getRotationDegrees();
foreArmL->setRotation(localRot.getRotationDegrees()+foreArmLInitRotation);