In attempting to understand the issue. I have written the following two
snipits of code in an #if 0 - #else.
The code that simply creates an AnimationPathCallBack around a PivotPoint works
as expected and rotates around the desired location.
But, the second snippet that uses ControlPoint rotates around a different
location in space.
What is the difference between the two blocks of code in relation to rotation
and pivot points?
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));
rWidgetPath->insert( 3.0f, C0 );
rWidgetPath->insert( 15.0f, C1 );
osg::ref_ptr<osg::AnimationPathCallback> AniCallback = new
osg::AnimationPathCallback( rWidgetPath.get() );
pWidgetMT->setUpdateCallback( AniCallback.get() );
#endif
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=28161#28161
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org