Hi,

I've noticed that when holding information from animation channels, only gives 
me the bone local position information. "rotateX", "rotateY" and "rotateZ" 
values are always 0.
Code as I do:


Code:

osg::ref_ptr<osgAnimation::Bone> actualBone = 
_AnimationManager->getSkeletonBone(actualBoneName);
while(actualBone->getParents().size()>0)
{
float rotateX, rotateY, rotateZ;
osg::Vec3 pos;
for(int j=0;j\channelList.size();j++)
{       
osgAnimation::Channel* channel = channelList[j];
if(!channel->getTargetName().compare(actualBoneName))
{
if(!channel->getName().compare("translate"))
{
osg::ref_ptr\osgAnimation::Vec3Target> posTarget = 
dynamic_cast\osgAnimation::Vec3Target*>(channel->getTarget());
pos = posTarget->getValue();
}
else if(!channel->getName().compare("rotateX")){
osg::ref_ptr\osgAnimation::FloatTarget> xTarget = 
dynamic_cast\osgAnimation::FloatTarget*>(channel->getTarget());
rotateX = xTarget->getValue();
}
else if(!channel->getName().compare("rotateY")){
osg::ref_ptr\osgAnimation::FloatTarget> yTarget = 
dynamic_cast\osgAnimation::FloatTarget*>(channel->getTarget());
rotateY = yTarget->getValue();
}
else if(!channel->getName().compare("rotateZ")){
osg::ref_ptr\osgAnimation::FloatTarget> zTarget = 
dynamic_cast\osgAnimation::FloatTarget*>(channel->getTarget());
rotateZ = zTarget->getValue();                                                  
        
break;
}
}
}
osg::Quat rot(osg::DegreesToRadians(rotateZ),osg::Vec3(0,0,1),
osg::DegreesToRadians(rotateY),osg::Vec3(0,1,0),
osg::DegreesToRadians(rotateX),osg::Vec3(1,0,0));
                                        osg::Matrix 
mat(osg::Matrix::rotate(rot));
                                        mat.setTrans(pos);
                                        desiredMatrix.preMult(mat);

actualBoneName = actualBone->getParent(0)->getName();
actualBone = _AnimationManager->getSkeletonBone(actualBoneName);
if(!actualBone.valid())
break;
}




Without the information of local rotation of each bones I can't calculate its 
transformation matrix in skeletal space!
I'm doing something wrong?!

Thank you!

Cheers,
Aitor

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





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

Reply via email to