fix camera bug

This commit is contained in:
gugus 2011-02-23 12:28:13 +01:00
parent 86ded891d9
commit 33f22fd68b

View file

@ -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. //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 quat = sceneNode->getChildIterator().getNext()->getOrientation();
Ogre::Quaternion quat2; //Ogre::Quaternion quat2;
Ogre::Matrix3 mat; //Ogre::Matrix3::
quat.ToRotationMatrix(mat); //Ogre::Matrix3 mat;
Ogre::Radian x,y,z; //quat.ToRotationMatrix(mat);
mat.ToEulerAnglesXYZ(x,y,z); //Ogre::Radian x,y,z;
mat.FromEulerAnglesXYZ(x,z,y); //mat.ToEulerAnglesXYZ(x,y,z);
Ogre::Vector3 dir = mat*iter->second;*/ //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: //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; //std::cout << "duration " << duration << std::endl;
eng->stepSimulation(duration); eng->stepSimulation(duration);