[osg-users] How to rotate node's local coordinate system?

Elias Tarasov elias.tarasov at gmail.com
Mon Jun 22 20:14:20 PDT 2015

I'm sorry for noob question, but i cannot figure out how to rotate node's local coordinate system.

For my task i use default OSG cessna model. According to my experiments, it has axes: X - from center to left wing. Y - from center down tail. Z - down.

What i want is to rotate axes: X - from center to nose. Y - from center to right wing. Z - down. 

I think i have skills to define rotation matrix, but i don't know the way to rotate osg::Node and save that rotated osg::Node. 

Basically something like that:


osg::ref_ptr<osg::Node> cessna = osgDB::readNodeFile(...)
//Here should be the "rotation" func
osg::ref_ptr<osg::Node> rotated_cessna = rotateLocalXYZ(cessna.get())

nodeTracker = new osgGA::NodeTrackerManipulator;

//now here i can setup eye and up vectors more consistently
nodeTracker->setHomePosition( Vec3(0,270,0), Vec3(), Z_AXIS );

nodeTracker->setTrackerMode( osgGA::NodeTrackerManipulator::NODE_CENTER_AND_ROTATION );
nodeTracker->setTrackNode( rotated_cessna.get() );

Can anybody provided an example how to do it?

Thank you!


Read this topic online here:

More information about the osg-users mailing list