Hi,
I'm trying to create new animations with QuatSphericalLinearSampler to
concatenate the animations that I'm lauching. The general idea is to have
smooth transitions between two animations.
I create the animation like this:
Code:
osgAnimation::Animation* anim = new osgAnimation::Animation;
typedef std::map<std::string, osg::Matrix>::iterator it_type;
for(it_type it = desiredMatrixs.begin(); it != desiredMatrixs.end(); it++)
{
std::string boneName = it->first;
osgAnimation::QuatKeyframeContainer* keys0 = new
osgAnimation::QuatKeyframeContainer;
keys0->push_back(osgAnimation::QuatKeyframe(0.0, osg::Quat()));
keys0->push_back( osgAnimation::QuatKeyframe(ANIM_TRANSITION_TIME,
it->second.getRotate()));
osgAnimation::QuatSphericalLinearSampler* sampler = new
osgAnimation::QuatSphericalLinearSampler;
sampler->setKeyframeContainer(keys0);
osgAnimation::QuatSphericalLinearChannel* channel = new
osgAnimation::QuatSphericalLinearChannel(sampler);
channel->setName("rotate");
channel->setTargetName(boneName);
anim->addChannel(channel);
}
std::stringstream ss;
ss << "transAnim" << debug;
anim->setName(ss.str());
anim->setPlayMode(osgAnimation::Animation::ONCE);
m_osgAnimationManager->regAnimation(anim);
m_osgAnimationManager->playAnimation(anim, speed, priority, initTime);
So I precalculate the next animation start bones local matrix and I insert
these into the second key of QuatKeyframeContainer.
I supouse that I'm doing something wrong because these animation not finish in
the same orientation that they shoul.
Other problem is that when I play these animations I loss the pose of the last
animation and these starts from the pose in which the model is loaded.
Basically I get a fucking transition animations... Someone to help me in the
right way?
Thank you!
Cheers,
Aitor
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=58448#58448
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org