Hello forum,
I am trying to rorate an object continuously through a call back. Before calling the calback i am doing some affine transformation over that object The final rendered the scaled down to a tiny object . In the callback subclass i am overloading the () operator and i am performing the rotation, not any kind of scaling down. **********************code**************************' class RotateCB : public osg::NodeCallback { public: RotateCB() : m_angle(0) { } virtual void operator()(osg::Node *node, osg::NodeVisitor *nv) { /* Normally, check to make sure that we have an update visitor, not necessary in this simple example */ osg::MatrixTransform * mtLeft = dynamic_cast<osg::MatrixTransform*>(node); osg::Matrix mR; mR.makeRotate(m_angle, osg::Vec3(0.0f,0.0f,1.0f)); mtLeft->setMatrix(mR); //Increment the angle for the next from m_angle += 0.01; /* Continue traversing so that OSG can process any other nodes with callbacks */ traverse(node,nv); } ................................. ................................ osg::ref_ptr<osg::MatrixTransform> teapotPos = new osg::MatrixTransform; osg::Matrix teapotTransMat; osg::Matrix teapotScaleMat; osg::Vec3f teapotTransVec = osg::Vec3f(5,2,-12); osg::Vec3f teapotScaleVec = osg::Vec3f(20.1f,20.1f,20.1f); teapotTransMat.makeTranslate(teapotTransVec); teapotScaleMat.makeScale(teapotScaleVec); teapotPos->setMatrix(teapotTransMat * teapotScaleMat); //SET THE data variance to dynamic to let OSG know that //we shall modify this node during update traversal teapotPos->setDataVariance(osg::Object::DYNAMIC); //SET THE update callback teapotPos->setUpdateCallback(new RotateCB); ................................................ ................................................... *****************************************************' Any hint? Sajjad
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org