Hi,
I placed this question in a thread, but decided to placed also in here, to be
more visible. Hope you can forgive me.
I'm using a CyberGlove II and my task is to "translate" my hand movements to a
simple FBX 3D model.
I managed to place the model and the data from the glove. I also managed to get
this data to command the model, attributing
the correspondent glove data to the corresponding bone.
But there's something I didn't quite catch when updating the bone.
I had this from the osgAnimation::UpdateBone:
(I know this can be a lot more efficient but for now is just for testing)
(For the thumb finger - 3 sensors
"luva" is the object where I get the data from the glove sensors)
Code:
osgAnimation::Bone* b1 = dynamic_cast<osgAnimation::Bone*>(node1);
osgAnimation::Bone* b2 = dynamic_cast<osgAnimation::Bone*>(node2);
osgAnimation::Bone* b3 = dynamic_cast<osgAnimation::Bone*>(node3);
osg::Matrix mt1;
mi1.makeRotate(luva.finger0[0], osg::Vec3f(0.0,0.0,1.0));
b1->setMatrix(mt1);
I thought this was enough to update the bone position, since I read that the
setMatrix would do this.
But then I've continued to add the code present in UpdateBone, like this:
Code:
osgAnimation::Bone* parent1 = b1->getBoneParent();
if (parent1)
b1->setMatrixInSkeletonSpace(b1->getMatrixInBoneSpace() *
parent1->getMatrixInSkeletonSpace());
else
b1->setMatrixInSkeletonSpace(b1->getMatrixInBoneSpace());
This code makes the trick, but I think displaces the bones to a relative
position from the correspondent parent bone. It seems like it displaces the
bones to the
origin.
What can I do to correct this? I'm thinking of something like a normal
transformation in OpenGL (pushMatrix, popMatrix),but
i'm a newbie with OSG.
I've atteached two screenshots illustrating my problem.
Thank you!
Cheers,
Leonel
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=41966#41966
Attachments:
http://forum.openscenegraph.org//files/glovedata_2011_08_08_12_32_01_61_126.bmp
http://forum.openscenegraph.org//files/glovedata_2011_08_08_12_14_31_80_118.bmp
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org