Time for action - performing translations of child nodes
Now we are going to make use of the transformation node. The
osg::MatrixTransform node, which multiplies the current model-view matrix with a specified one directly, will help to transfer our model to different places in the viewing space.
- Include the necessary headers:
#include <osg/MatrixTransform> #include <osgDB/ReadFile> #include <osgViewer/Viewer>
- Load the Cessna model first:
osg::ref_ptr<osg::Node> model = osgDB::readNodeFile( "cessna.osg" );
osg::MatrixTransformclass is derived from
osg::Group, so it can use the
addChild()method to add more children. All child nodes will be affected by the
osg::MatrixTransformnode and be transformed according to the presetting matrix. Here, ...