You might also consider changing your app to use a y-up convention so that it matches the (apparently immutable) OpenNI modeling space.
   -Paul

On 3/31/2011 9:03 AM, Aitor Ardanza wrote:

Paul Martz wrote:
Rotate 90 degrees around the x axis (or -90, depends on right- versus
left-handed coordinates; try one, then the other, to see which one works).

This is not a secret. :-) There is plenty of OSG code that does this. Most of
the OSG plugins support an option to transform from a y-up to z-up convention.
-Paul


On 3/31/2011 3:09 AM, Aitor Ardanza wrote:

Hi,

I need to do it for my proyect... but I can't get good results.
OpenNI (Kinect) gives me the matrix with "Y up":

Code:
XnSkeletonJointPosition jointPos;
g_UserGenerator.GetSkeletonCap().GetSkeletonJointPosition(player, eJoint, 
jointPos);
XnMatrix3X3 orient;
orient = jointOrient.orientation;
tracker->set(orient.elements[0], orient.elements[1], orient.elements[2], 0,
orient.elements[3], orient.elements[4], orient.elements[5], 0,
orient.elements[6], orient.elements[7], orient.elements[8], 0,
jointPos.position.X, jointPos.position.Y, jointPos.position.Z, 1);


What I have to do to swap the Z and Y axes? multiply that by the matrix C?
C = 1 0 0 0
0 0 1 0
0 1 0 0
0 0 0 1

Code:
tracker->postMult(C);

????

Thank you!

Cheers,
Aitor

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=38104#38104





_______________________________________________
osg-users mailing list

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org





--
-Paul Martz      Skew Matrix Software
http://www.skew-matrix.com/
_______________________________________________
osg-users mailing list

http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

  ------------------
Post generated by Mail2Forum

Hello Paul!
I understand what you suggest me, but I do not know how to apply... because if 
you multiply that rotation directly to matrix, avatar is deformed.
So... if I define the openni global matrix:

Code:
XnMatrix3X3 orient;
orient = jointOrient.orientation;
tracker->set(orient.elements[0], orient.elements[1], orient.elements[2], 0,
orient.elements[3], orient.elements[4], orient.elements[5], 0,
orient.elements[6], orient.elements[7], orient.elements[8], 0,
jointPos.position.X, jointPos.position.Y, jointPos.position.Z, 1);



And then to know the local rotation of each bone ...
Code:

if(!sceneM->getAnimatedModel()->boneMatrices[j]->getName().compare("R_Shoulder")){
mat.set(osg::Matrix::inverse(*jointsTracker.at(SkeletonJoint::NECK)));
mat.postMult(*jointsTracker.at(SkeletonJoint::RIGHT_SHOULDER));

sceneM->getAnimatedModel()->boneMatrices[j]->setMatrix(mat);
}


and the last action is to apply these local matrix to each bone:

Code:
pBoneUpdate.at(i)->getStackedTransforms().push_back(new 
osgAnimation::StackedQuaternionElement("rotate",boneMatrices[i]->getMatrix().getRotate()));



Could serve if I define the axes of the nodes in Maya with the axes Z and Y 
swapped?
I do not know if I will clarify things further, or I have left more confused 
... jaja. Sorry!

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=38132#38132





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




--
  -Paul Martz      Skew Matrix Software
                   http://www.skew-matrix.com/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to