In my initial thoughts I think I've already kind of knew a possible answer, but 
knowing how to implemented was beeing a challenge.

While searching I stumbled in this forum, with a thread that had a similar 
issue.

After reading it I tried to adapt to what I had. This was the result and it's 
working:


Code:

//Define generic axis
osg::Vec3d x = osg::Vec3d(1,0,0);
osg::Vec3d y = osg::Vec3d(0,1,0);
osg::Vec3d z = osg::Vec3d(0,0,1);




For what I understand you must get the original matrix for the position of the 
skeleton and then calculate the rotation of the bone using Quaternions, and 
then applying this rotation to the original position matrix:


Code:

//b1 is a bone //luva is the glove where you get the rotation values
osg::Matrix m1;
osg::Matrixd r1=osg::Matrixd(osg::Quat(0,x, luva.finger0[0], y, 0, z));
m1 = r1 * b1->getMatrix(); 
b1->setMatrix(m1);




And then, make the update:

Code:

osgAnimation::Bone* parent1 = b1->getBoneParent();
if (parent1)
    b1->setMatrixInSkeletonSpace(b1->getMatrix() * 
parent1->getMatrixInSkeletonSpace());
else
    b1->setMatrixInSkeletonSpace(b1->getMatrix());




Now I have to refine the rotations :)

Hope it can be of any help to someone.

Cheers,
Leonel[/code]

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





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to