First I have to apologize for my English.
I am working on an application in which every moment I need to know the attributes of each node (position, rotation ...), so I thought about taking the transformation matrix of each node from the scene graph.
The problem that I have is that I do not know how to do this. For example, if I have something like:
osg::ref_ptr<osg::Node> root = osgDB::readNodeFile("cessna.osg.15,20,25.trans.180,90,360.rot.2,3,4.scale");
I want to take the transformation matrix from a node object called root. I found something like:
osg::Matrix mat = osg::computeWorldToLocal(this->getNodePath()); std::cout << "X: " << mat.getTrans().x() << std::endl; std::cout << "Rot X: " << mat.getRotate().x() << std::endl; std::cout << "Scale X: " << mat.getScale().x() << std::endl;
But I would just like to have only a matrix, is this possible?
Thanks.
PD: I use nodeVisitor for this.
source share