Relative Joint Rotation

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
w00f
Posts: 10
Joined: Sun Dec 11, 2011 11:29 am

Re: Relative Joint Rotation

Post by w00f »

Hi Tekkai,

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;
Then I calculate the local rotation:

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);
 
Is there anything that I am missing here since this is not producing correct results? Arggg :x :x
Tekkai
Posts: 24
Joined: Tue Mar 30, 2010 2:02 pm
Contact:

Re: Relative Joint Rotation

Post by Tekkai »

Hey,

Can you please run a simple test? Take all your bones and do a setRotation(0,0,0). When I was loading the model from 3DMax, the model was loaded correctly (I don't even have to flip Y or X) BUT if I tried to set the rotation of each bone to 0, then the model position was wrong. That won't fix the problem, but is a start to know if you have the same issue or not. Also, you will have to multiply by the bind pose and it's inverse.

Cheers,
w00f
Posts: 10
Joined: Sun Dec 11, 2011 11:29 am

Re: Relative Joint Rotation

Post by w00f »

Hi Tekkai,

Load the model, it display ok.

If I set the rotation to 0-0-0, the positions of the joints are wrong also.

What is the bind pose and it's inverse u mentioning? Is this the initial rotation absoluteTransformation or local rotation of the bone (when we load the model into Irrlicht).

Can you check the way I converted 3x3 openNI matrix to 4x4 Irrlicht matrix also. Ignore the negative sign just check if I loaded the rows and column correctly?
Post Reply