nodeCallBack problem

classic Classic list List threaded Threaded
2 messages Options
cxh860315 cxh860315
Reply | Threaded
Open this post in threaded view

nodeCallBack problem

    osg 3.6.5 ,osgEarth 2.10.2, Win10, VS2013 64bit

    I try to add a nodecallback on the subnode of AnimationPathCallback node , let subnode  rotate when

they move. But I debug to find the nodecallback can come into operator() function.

   When i attach the nodecallback to other model node without animationpathcallback, operator()function

can is called,the model can rotate.

 code segment:

        m_cstMT = new osg::MatrixTransform;
        m_mairplaneMT = new osg::MatrixTransform;
        airplaneAnipathCallback = new osg::AnimationPathCallback(airplaneAnimPath, 0.0, 1.0);

        m_autoRotateCallback = new TM::AutoRotateCallBack;
        m_cstMT ->setUpdateCallback(m_autoRotateCallback);

class AutoRotateCallBack : public osg::NodeCallback
                AutoRotateCallBack() :_rotateZ(0.0) {}

                virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
                        osg::ref_ptr<osg::MatrixTransform> mt = dynamic_cast<osg::MatrixTransform*>(node);
                        osg::Matrix mx;
                        mx.makeRotate(_rotateZ, osg::Vec3(0.0, 0.0, 1.0));
                        _rotateZ += 0.1;

                        traverse(node, nv);

                double _rotateZ;

  I do not know how to solve this problem. hoping for everyone help. Thanks!
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view

Re: nodeCallBack problem


I recommend you ask this question on the OpenSceneGraph support group. They may be able to help:

Glenn Waldron / Pelican Mapping