[osg-users] Traversing model nodes and rotating

Alberto Luaces aluaces at udc.es
Wed Jul 23 12:22:17 PDT 2008


Hi Ümit,

I'm glad I could help. The tool I used was osgdot, a program by Paul Melis. 
See its thread at

http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2007-November/004350.html

It is is currently hosted in the Mike Weiblen's osgtoy repository :

http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2007-November/004377.html

Regards,

Alberto



El Miércoles 23 Julio 2008ES 20:41:17 Ümit Uzun escribió:
> Hi Alberto,
>
> Thanks for reply. Yes, it doesn't show my expected structure. I have to
> traverse and reorganize all nodes with nodevisitor. And I have another
> question about extracting the model in graph. What application do you use
> for extracting the model graph as a image or any document like
> graphicgy.png?
>
> Thanks so much!
>
> Ümit UZUN
>
> 2008/7/23 Alberto Luaces <aluaces at udc.es>:
> > Hi Umit,
> >
> > maybe the hierarchy is wrong. I have extracted the graph and it doesn't
> > show
> > the three concatenated transforms that you describe. I attach the graph
> > file
> > in case you are interested.
> >
> > Alberto
> >
> > El Miércoles 23 Julio 2008ES 14:06:36 Ümit Uzun escribió:
> > > Hi all,
> > >
> > > I have an model in 3ds format. I convert it to osg and look in it for
> > > hierarchical structure. It has mainly 5 part which was tied themselves
> > > like;
> > >
> > > PLANETARY -> (child)YAW -> (child)ROLL -> (child)PITCH ->
> > > (child)PILOTCABIN.
> > >
> > >
> > > I am opening this model with osgDB::readNodeFile and then I am starting
> >
> > to
> >
> > > traverse in it to find expected node (for example ROLL node).
> > > I can find the node and it's parent node which is MatrixManipulator
> > > node and then I can rotate it around the pivot point but when I
> > > rotating the ROLL node
> > > I am expecting to occur the automatic rotate to it's child nodes. But
> > > the child nodes doen't rotate. How can I do for solve this problem?
> > > Should I add external transformation node between the required place in
> >
> > the
> >
> > > scene graph or is it not necessery?
> > >
> > > Please look at the model hierarchy and advice me to what shoul I do?
> >
> > -------------------------------------------------------------------------
> >--
> >
> > >------------------------- class findNodeCallback : public
> >
> > osg::NodeCallback
> >
> > > {
> > > public:
> > >    virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
> > >    {
> > >
> > >        findNodeVisitor findNode("roll");
> > >        node->accept(findNode);
> > >
> > >        float i=0.0f;
> > >        osg::Matrix rotation,m;
> > >
> > >        osg::ref_ptr<osg::MatrixTransform> foundData =
> > > dynamic_cast<osg::MatrixTransform*>
> > > (findNode.getFirst()->getParent(0));
> > >
> > >       if(foundData != NULL)
> > >       {
> > >          i+=0.1f;
> > >          rotation.makeRotate( i, osg::Vec3f(0.0f,0.0f,1.0f) );
> > >          m = foundData->getMatrix();
> > >          m = m * rotation;  // rotate around matrix axis (local space)
> > >          foundData->setMatrix(m);
> > >       }
> > >       traverse(node, nv);
> > >    }
> > > };
> > >
> > > With this code I can rotate only roll node, it's child nodes doesn't
> >
> > effect
> >
> > > by this traversing.
> >
> > -------------------------------------------------------------------------
> >--
> >
> > >-------------------------
> > >
> > > Thanks so much,
> > >
> > > Umit UZUN
> >






More information about the osg-users mailing list