Fixed auto rotate to screen so that it handles scales in to the parental path

This commit is contained in:
Robert Osfield
2007-02-26 14:36:43 +00:00
parent 7f8f4e331a
commit b55f5c2bd8

View File

@@ -12,6 +12,8 @@
*/
#include <osg/AutoTransform>
#include <osg/CullStack>
#include <osg/Notify>
#include <osg/io_utils>
using namespace osg;
@@ -161,7 +163,13 @@ void AutoTransform::accept(NodeVisitor& nv)
if (_autoRotateMode==ROTATE_TO_SCREEN)
{
osg::Quat rotation = cs->getModelViewMatrix()->getRotate();
osg::Vec3d translation;
osg::Quat rotation;
osg::Vec3d scale;
osg::Quat so;
cs->getModelViewMatrix()->decompose( translation, rotation, scale, so );
setRotation(rotation.inverse());
}
else if (_autoRotateMode==ROTATE_TO_CAMERA)