<div dir="ltr"><div><div>Hi Elias,<br><br></div>The osg::Transform is the base class for creating transforms in the scene graph, there are a collection of subclasses that you can use, osg::MatrixTransform and osg::PositionAttitudeTransform being the most commonly used, either of these can work for you. Have a look at the osganimation example to see how to use these classes, or just do a search in the examples for MatrixTransform/PositionAttitudeTransform.<br><br></div>Robert.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 23 June 2015 at 04:14, Elias Tarasov <span dir="ltr"><<a href="mailto:elias.tarasov@gmail.com" target="_blank">elias.tarasov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello!<br>
I'm sorry for noob question, but i cannot figure out how to rotate node's local coordinate system.<br>
<br>
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.<br>
<br>
What i want is to rotate axes: X - from center to nose. Y - from center to right wing. Z - down.<br>
<br>
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.<br>
<br>
Basically something like that:<br>
<br>
Code:<br>
<br>
osg::ref_ptr<osg::Node> cessna = osgDB::readNodeFile(...)<br>
//Here should be the "rotation" func<br>
osg::ref_ptr<osg::Node> rotated_cessna = rotateLocalXYZ(cessna.get())<br>
<br>
nodeTracker = new osgGA::NodeTrackerManipulator;<br>
<br>
//now here i can setup eye and up vectors more consistently<br>
nodeTracker->setHomePosition( Vec3(0,270,0), Vec3(), Z_AXIS );<br>
<br>
nodeTracker->setTrackerMode( osgGA::NodeTrackerManipulator::NODE_CENTER_AND_ROTATION );<br>
nodeTracker->setTrackNode( rotated_cessna.get() );<br>
<br>
<br>
<br>
Can anybody provided an example how to do it?<br>
<br>
Thank you!<br>
<br>
Cheers,<br>
Elias<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=64149#64149" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=64149#64149</a><br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div><br></div>