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

StackOverflow https://stackoverflow.com/questions/23360789

  •  11-07-2023
  •  | 
  •  

Pergunta

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?

Foi útil?

Solução

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

Outras dicas

You will have to find the node that corresponds with that subsection of the model. To do this you will need to identify something that is unique about that node (hopefully it has a name or something).

Once you have that node, you may need to break it off of the main tree, add a Transform of some kind (a PositionAttitudeTransform, probably) and then re-add your node as a child of the PAT.

Then you can modify the rotations in the PAT.

You might use a visitor like the find named node(s) visitor to locate the node you want.

Consider converting the .ive file to .osgt or .osg in order to see the structure (and hopefully node names) in the file.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top