Hi, again.

I'm not sure if you want to animate whole hierarchy. 

I also implement hierarchical structure for rendering car, and it should be 
possible to turn on and off each part. In additon, it should animate also by 
following hierarchical structure(e.g. translate car and rotating wheels).

If so u can use "AnimationPath" and "AnimationPathCallback".

Then, what you need to care is each transform (translate, roate, scale) has 
each PositionAttitudeTransform(PAT)

like below might help: ... OMG, i can't post link yet. i just copy and paste it
=======================================
osg::Node* pWidgetNode = FindNodeByName( pModel, "roller_piv" );
        osg::MatrixTransform* pWidgetMT = AddMatrixTransform( pWidgetNode );
        osg::Vec3       PivotPoint (0,  26.45 , -22.3);
        osg::ref_ptr<osg::AnimationPath> rWidgetPath = new osg::AnimationPath;

#if     1

        ///     This block of code rotates around the pivot point as expected.
        pWidgetMT->setUpdateCallback( new 
osg::AnimationPathCallback(PivotPoint, osg::X_AXIS,
osg::inDegrees(45.0f)) );

#else

        //      This block of code rotates around a completely different 
location in space
        //      What is the difference between this and the code above in 
relation to rotation and pivot 
        //      points?

        osg::AnimationPath::ControlPoint  C0( PivotPoint, osg::Quat(0,  
osg::X_AXIS) );  
        osg::AnimationPath::ControlPoint C1(PivotPoint, osg::Quat( 
osg::inDegrees(45.0f),
osg::X_AXIS));   

===============



Simply, hierarchy look like below
================
PATfor translate
|
PATfor rotate
|
switch
===============

the structure above can be a node for tree-hierarchy.

I tested it works! :D

goodluck


Thank you!

Cheers,
Soonchan
Code:




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





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

Reply via email to