Search code examples
c++copenglopenscenegraph

How do I rotate/translate existing OpenSceneGraph (OSG) nodes from a loaded .ive model tree?


I have a given model in .ive and the problem is that I'm trying to rotate a single node out of the whole tree model (existing in the .ive file). Is that possible? How can I do that?


Solution

  • Sure, it can be done.

    You first have to find the nodes that you want to manipulate. You should be able to do this by creating a subclass of osg::NodeVisitor, and using it to traverse the graph until you find the node you want to manipulate. If you've given the node a name, it can be simple to find the one you are looking for. If not, you'll have to figure out some other unique characteristics of the node, or just pull all nodes of a certain type and try them one at a time.

    Then, once you have that, you can just save a pointer and manipulate it directly.

    See tutorials:

    https://www.movesinstitute.org/Sullivan/OSGTutorials/osgDOF.html

    and

    https://www.movesinstitute.org/Sullivan/OSGTutorials/osgUpdate.htm