[osg-users] How do I set NodeTrackerManipulator to rotate with the nodes?

mirr...@gmail.com mirro187 at gmail.com
Sun Jan 3 00:55:35 PST 2021


W10 gtx3.x OSG3.6.4

 osgGA::NodeTrackerManipulator::TrackerMode trackerMode = 
osgGA::NodeTrackerManipulator::NODE_CENTER_AND_AZIM;

  osgGA::NodeTrackerManipulator::RotationMode rotationMode = 
osgGA::NodeTrackerManipulator::TRACKBALL;


osg::ref_ptr<osg::Node> glider = osgDB::readRefNodeFile("glider.osgt");
if (glider)
{
        const osg::BoundingSphere& bs = glider->getBound();

        float size = radius/bs.radius()*0.3f;
        osg::MatrixTransform* positioned = new osg::MatrixTransform;
        positioned->setDataVariance(osg::Object::STATIC);
        positioned  ->setMatrix(osg::Matrix::translate(-bs.center())*
                                     osg::Matrix::scale(size,size,size)*
                                    
 osg::Matrix::rotate(osg::inDegrees(-90.0f),0.0f,0.0f,1.0f));

        positioned->addChild(glider);

        osg::PositionAttitudeTransform* xform = new 
osg::PositionAttitudeTransform;
        xform->setUpdateCallback(new 
osg::AnimationPathCallback(animationPath,0.0,1.0));
        xform->addChild(positioned);

        *  osgGA::NodeTrackerManipulator* tm = new 
osgGA::NodeTrackerManipulator;*
*          tm->setTrackerMode( trackerMode );*
*          tm->setRotationMode( rotationMode );*
*          tm->setTrackNode( xform );*
*          viewer.setCameraManipulator(tm);*
 }

-- 
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/7bb98730-bb2d-4f98-ae68-4a70ef9d9c1cn%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20210103/a915b1fa/attachment.html>


More information about the osg-users mailing list