Rotating PlaceNode

classic Classic list List threaded Threaded
4 messages Options
Greg @ NHI Greg @ NHI
Reply | Threaded
Open this post in threaded view
|

Rotating PlaceNode

I am using PlaceNodes to mark locations on earth maps.  I would like to rotate the PlaceNodes so they point in specific directions (flat 2D images but rotated around the center point of the image).  The PlaceNodes contain an osg::Image, which has alignment set to ALIGN_CENTER_CENTER.  I am able to scale them using the following code:


goNode->setScale(osg::Vec3f(graphicalObject->scaleFactor, graphicalObject->scaleFactor, graphicalObject->scaleFactor));

However, I am not able to rotate them.  I have tried the following code:

                                                osg::Quat q;
                                                q.makeRotate(osg::DegreesToRadians(graphicalObject->rotationFactor), osg::Y_AXIS);
                                                goNode->setLocalRotation(q);

And this:

                                                osg::Quat q;
                                                q.makeRotate(osg::DegreesToRadians(graphicalObject->rotationFactor), osg::Y_AXIS);
                                                goNode->getPositionAttitudeTransform()->setAttitude(q);

I have also tried changing the axis (X_AXIS, Z_AXIS) but nothing changes.

Any suggestions would be appreciated.

Regards,

Greg
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Rotating PlaceNode

Hi Greg.
PlaceNodes are rendered in screen space and cannot be rotated in 3D. Sorry!
Glenn Waldron / Pelican Mapping
Greg @ NHI Greg @ NHI
Reply | Threaded
Open this post in threaded view
|

Re: Rotating PlaceNode

Thank you.  That's what I thought.

JD JD
Reply | Threaded
Open this post in threaded view
|

Re: Rotating PlaceNode

Maybe you need to use text-geographic-course like illustrated in annotation.earth exemple (possible also through code, in textSymbol).
Like said by Glenn it will be an "on screen" rotation, but it will be automatically computed at each frame to follow a given bearing.