Hi Josue & Morad, Here is a newbie explanation :
- First time, you need to know that the *osgDB *library provides access to a lot of 2D and 3D files ( like .fbx ), by managing several *osg * plugins. - You intend to use an fbx file, so you need to check if the plugin "FBX reader/writer" is correctly installed. - In second, the following snippet enable to load the scene graph of an fbx file: osg::ref_ptr<osg::Node> root = osgDB::readNodeFile( fbxFile ) > - Then, locate the *AnimationManager *you want to use either *Basic *or * Timeline*, according to your necessity. [image: a02292.png] - the best way is to use the design pattern Visitor, already implemented in *osg::NodeVisitor*. struct AnimationManagerFinder : public osg::NodeVisitor > { > osg::ref_ptr<osgAnimation::BasicAnimationManager> _am; > > AnimationManagerFinder() > {setTraversalMode(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN); } > > void apply(osg::Node& node) { > > if (_am.valid()) > return; > > if (node.getUpdateCallback()) { > _am = > dynamic_cast<osgAnimation::BasicAnimationManager*>(node.getUpdateCallback()); > return; > } > > traverse(node); > } > }; > - In the previous code snippet, the *BasicAnimationManager*, if it is found, will be stored on the variable* '_am' *located at *finder._am.* - in your main function: AnimationManagerFinder finder; > root->accept(finder); > - then you can recuperate the *AnimationList* avalaible in your fbx file like this: const osgAnimation::AnimationList& animations = > finder._am->getAnimationList(); > - Finally, you can do what ever you want: play the animation on the * osgViewer*, get the *Duration*, the *StartTime*, the *Name *of the animation... specify the *PlayMode*.. finder._am->playAnimation( animations[an].get() ); ... > std::cout << "name animation: " << animations[an]->getName() << std::endl; > I hope I helped :) please feel free to respond to this topic to ameliorate it. Have a nice day* --* *M. ALJI **Mohamed *
<<a02292.png>>
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org