[osg-users] FindNodeVisitor Operation?

Ümit Uzun umituzun84 at gmail.com
Tue Jul 15 04:50:50 PDT 2008


Hi David,

Firstly thanks for reply. I actually want to handle part of model components
and make some operation on them. I have tried findNodeVisitor sample for my
model. My model has 7 children node and all of them are geode node. But I
have 8 MatrixTransform node which are handle only 4 of them, so I can't
handle some part of model.
When I control the number of founded node with,

   findNodeVisitor findNode("3DSPIVOTPOINT: Translate pivotpoint to (world)
origin");
   tankThreeGroup->accept(findNode);
   std::vector<osg::Node*> nodeList = findNode.getNodeList();
   int lenght=nodeList.size();
   std::cout<<"lenght : "<<lenght<<std::endl;

The output is 'lenght : 8'

What can I do now?
Should I create MatrixTransform nodes for the other unhandled nodes while
traversing in the model? Or Can I handle other 3 nodes different way?

You can download the model from here.(
http://www.fileden.com/files/2007/9/10/1423182/GL_6000_v22.3DS) And you can
use `osgconv GL_6000_v22.3DS GL_6000_v22.osg` then open GL_6000_v22.osg with
notepad.

Thanks so much.
Best Regards.

Ümit Uzun

2008/7/15 David Spilling <david.spilling at gmail.com>:

> Hi Ümit,
>
> osg::DOFTransform is a subclass of the more general osg::MatrixTransform.
>
> If I'm reading the intention of the model right, you have 2 MatrixTransform
> nodes - named "*3DSPIVOTPOINT: Rotate*" and "*3DSPIVOTPOINT: Translate
> pivotpoint to (world) origin*" above some geometry "*1_planetar*".
> (Although your top level group has 6 other unlisted children as well).
>
> If you want to move/rotate/translate 1_planetar, use the NodeVisitor to
> find one of your two MatrixTransform nodes, and then set the transform's
> matrix yourself (via setMatrix(osg::Matrix& myMatrix)). You will need to
> fill in the values of the matrix yourself based on what you want to do, but
> there are many many ways of doing this (makeRotate, makeTranslate,
> makeLookAt etc.)
>
> Alternatively, if you really want to use DOFTransform type methods, you
> could dynamic_cast the found MatrixTransform to a DOFTransform.
>
> Hope that helps,
>
> David
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080715/28a5ec39/attachment-0003.htm>


More information about the osg-users mailing list