From 33f22fd68bae686aa72b2af543c5867ddaac5592 Mon Sep 17 00:00:00 2001 From: gugus Date: Wed, 23 Feb 2011 12:28:13 +0100 Subject: [PATCH] fix camera bug --- apps/openmw/mwrender/mwscene.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwrender/mwscene.cpp b/apps/openmw/mwrender/mwscene.cpp index d744ff869..dd44be882 100644 --- a/apps/openmw/mwrender/mwscene.cpp +++ b/apps/openmw/mwrender/mwscene.cpp @@ -126,18 +126,20 @@ void MWScene::doPhysics (float duration, MWWorld::World& world, //first adjust the rotation of the object, which is not handled by the physic engine i believe. - /*Ogre::SceneNode *sceneNode = rend.getScene()->getSceneNode (iter->first); + Ogre::SceneNode *sceneNode = rend.getScene()->getSceneNode (iter->first); Ogre::Quaternion quat = sceneNode->getChildIterator().getNext()->getOrientation(); - Ogre::Quaternion quat2; - Ogre::Matrix3 mat; - quat.ToRotationMatrix(mat); - Ogre::Radian x,y,z; - mat.ToEulerAnglesXYZ(x,y,z); - mat.FromEulerAnglesXYZ(x,z,y); - Ogre::Vector3 dir = mat*iter->second;*/ + //Ogre::Quaternion quat2; + //Ogre::Matrix3:: + //Ogre::Matrix3 mat; + //quat.ToRotationMatrix(mat); + //Ogre::Radian x,y,z; + //mat.ToEulerAnglesXYZ(x,y,z); + //mat.FromEulerAnglesXYZ(Ogre::Radian(0),z,Ogre::Radian(0)); + Ogre::Vector3 dir1(iter->second.x,iter->second.z,-iter->second.y); + Ogre::Vector3 dir = quat*dir1; //the add the movement: - act->setWalkDirection(btVector3(iter->second.x,iter->second.y,iter->second.z)*duration); + act->setWalkDirection(btVector3(dir.x,-dir.z,dir.y)*duration); } //std::cout << "duration " << duration << std::endl; eng->stepSimulation(duration);