On 21/03/10 16:27 , John Galt wrote: > I'm trying to access a child node to perform Position Attitude > Transformations but I > am unable to figure out how to do so. > > My createModel(overlay, technique) is defined as follows: >> .... >> osg::Group* root = new osg::Group; >> osg::Node* baseModel = createBase(osg::Vec3(center.x(), center.y(), >> baseHeight),radius); >> osg::Node* movingModel = createFrustumGeode(2,4,45,45); >> { >> >> root->addChild(baseModel); >> } >> >> root->addChild(movingModel); >> >> return root; >> } > > My main function has this code: >> .... >> >> // initialize the viewer. >> osgViewer::Viewer viewer; >> >> // load the nodes from the commandline arguments. >> osg::Node* model = createModel(overlay, technique); >> if (!model) >> { >> return 1; >> } > > > Now at this point in my main function, I want to access the child node of > model (say > the"movingModel" node) and perform a position attitude transformation on it. > > How do I access it and perform the transformation? Any suggestions would be > welcomed by this newbie.
To get to the 'movingModel' node you could either access it by its index (like model->getChild(1)' or write a visitor to find it by name. You can then dynamic_cast this to PositionAttitudeTransform and perform the desired operation. (The node has to be created as a PAT; it's not obvious what 'createFrustumGeode' creates.) Cheers, /ulrich _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org