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

Robert Osfield robert.osfield at gmail.com
Tue Jun 23 00:45:10 PDT 2015


Hi Elias,

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.

Robert.

On 23 June 2015 at 04:14, Elias Tarasov <elias.tarasov at gmail.com> wrote:

> Hello!
> 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:
>
> Code:
>
> 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!
>
> Cheers,
> Elias
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=64149#64149
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150623/788bf058/attachment-0003.htm>


More information about the osg-users mailing list