From bfad5ebde451bb0cab4bcb137621d3cf61197024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Fri, 8 Dec 2017 17:42:20 +0100 Subject: [PATCH] CS: Fix camera orbit control with keys --- apps/opencs/view/render/cameracontroller.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/opencs/view/render/cameracontroller.cpp b/apps/opencs/view/render/cameracontroller.cpp index f0158fe28..abf68ef93 100644 --- a/apps/opencs/view/render/cameracontroller.cpp +++ b/apps/opencs/view/render/cameracontroller.cpp @@ -690,7 +690,9 @@ namespace CSVRender osg::Vec3 absoluteUp = osg::Vec3(0,0,1); osg::Vec3d forward = center - eye; - osg::Quat rotation = osg::Quat(value, absoluteUp ^ forward); + + osg::Vec3d axis = absoluteUp ^ forward * (up.z() < 0.0 ? -1.0 : 1.0); + osg::Quat rotation = osg::Quat(value,axis); osg::Vec3d oldOffset = eye - mCenter; osg::Vec3d newOffset = rotation * oldOffset;