From b55f5c2bd873dfaa3ae3ff1850ca18e4cbac0071 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 26 Feb 2007 14:36:43 +0000 Subject: [PATCH] Fixed auto rotate to screen so that it handles scales in to the parental path --- src/osg/AutoTransform.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/osg/AutoTransform.cpp b/src/osg/AutoTransform.cpp index 58746a153..28b4176e9 100644 --- a/src/osg/AutoTransform.cpp +++ b/src/osg/AutoTransform.cpp @@ -12,6 +12,8 @@ */ #include #include +#include +#include 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)