[osg-users] NodeVisitor finds the named Node, but NodeCallback doesn't rotate it

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Mon Aug 3 07:00:06 PDT 2015

Am 01.08.2015 um 08:59 schrieb Elias Tarasov:
> Hi!
> I have .ac models. One is a quadrocopter and two others are it's engines. Each engine has propeller, which i want to animate by rotation. To do it, i have to find propeler's node for the start. What i was able to find that two ways are exist.
> First is to find a node by it's name.
> Second is to find a node by it's "unique characteristics".
> Here is models: https://drive.google.com/file/d/0ByDDImhSolf6cnVIN3JIMzJQTGs/view?usp=sharing
> So the 1st question:
> How to determine, the name of the node or it's other characteristics, to be able to find it?
Using NodeVisitors is the way to go with scenegraphs.
> I developed simple program that searches a node by it's name. Something, that looks like a node's name i found when open .ac file using notepad and search for the "name" tag. But im not sure.
> Here is code: https://drive.google.com/file/d/0ByDDImhSolf6U3BmTXpjeE1mRDg/view?usp=sharing
> The problem: NodeVisitor finds a node( though im not sure this node is a propeller), but NodeCallback doesn't rotate it.
> So the 2nd question: Why the element, identified by it's name, does not rotate?
> The reason, why im sure that these models should be able to rotate anyway, is that i took them from another app, based on OSG and it works well.

Your sample code isn't what I would consider minimal, so it is hard to 
spot an obvious error.
But I don't see how the MatrixTransform is related to your scene graph. 
You need to do something like this inside your callback

for (p : node->getParents())

Your code simply adds a new parent, so the propeller is most likely 
drawn twice the time you would expect.

Btw. If your visitor is looking for the node-name only you don't have to 
implement anything else but the apply(Node) as even the 
osg::Geode/osg::Drawables and are osg::Node-derived since version 3.3.0.


> Thank you!
> Cheers,
> Elias
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=64557#64557
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list