Hi Sergey,

Thanks for your advice! Unfortunately I'm not sure if I completely understood 
your solution. Would you mind to help me a little bit further?

Suppose I retrieved the model and the animation manager as follows:
osg::ref_ptr< osg::Node > model = osgDB::readNodeFile("nathan.osg");
osgAnimation::BasicAnimationManager* modelManager = dynamic_cast < 
osgAnimation::BasicAnimationManager* > (model->getUpdateCallback());

Now I  add one of several transforms:
osg::ref_ptr < osg::PositionAttitudeTransform > transform = new 
PositionAttitudeTransform();
transform->addChild(model);
transform->addUpdateCallback(modelManager.get());

And finally play all animations of the model:
const osgAnimation::AnimationList& animations = 
modelManager->getAnimationList();
for (unsigned int i=0; i < animations.size(); ++i )
{
  modelManager->playAnimation( animations[i].get() );
}

After reading your post I tried not to add the modelManager to the transform 
but  a new animation manger using the existing animations:
osg::ref_ptr < osgAnimation::BasicAnimationManager > manager = new 
osgAnimation::BasicAnimationManager;
for (unsigned int i = 0; i < modelManager->getAnimationList().size(); ++i)
{
osgAnimation::Animation* animation = new 
osgAnimation::Animation(*modelManager->getAnimationList()[i]);
// alternatively: osgAnimation::Animation* animation = 
modelManager->getAnimationList()[i];
manager->registerAnimation(animation);
}
transform->addUpdateCallback(manager);

But with this approach also all animations off all instances are playing in 
parallel. What am I missing?

Thank you!

Cheers,
Thilo

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





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

Reply via email to