correcting a bug: player orientation wasn't stored correctly, and objects orientation wasn't properly retrived.

actorid
gus 12 years ago
parent 372308b49a
commit e1882dce32

@ -273,16 +273,21 @@ bool RenderingManager::rotateObject( const MWWorld::Ptr &ptr, Ogre::Vector3 &rot
Ogre::Quaternion xr(Ogre::Radian(rot.x), Ogre::Vector3::UNIT_X);
Ogre::Quaternion yr(Ogre::Radian(rot.y), Ogre::Vector3::UNIT_Y);
Ogre::Quaternion zr(Ogre::Radian(rot.z), Ogre::Vector3::UNIT_Z);
Ogre::Quaternion newo = adjust ? (xr * yr * zr) * ptr.getRefData().getBaseNode()->getOrientation() : xr * yr * zr;
rot.x = newo.x;
rot.y = newo.y;
rot.z = newo.z;
Ogre::Quaternion xref(Ogre::Radian(ptr.getRefData().getPosition().rot[0]), Ogre::Vector3::UNIT_X);
Ogre::Quaternion yref(Ogre::Radian(ptr.getRefData().getPosition().rot[1]), Ogre::Vector3::UNIT_Y);
Ogre::Quaternion zref(Ogre::Radian(ptr.getRefData().getPosition().rot[2]), Ogre::Vector3::UNIT_Z);
Ogre::Quaternion newo = adjust ? (xr * yr * zr) * (xref*yref*zref) : xr * yr * zr;
rot.x = newo.getPitch().valueRadians();// newo.x;Ogre::Quaternion::
rot.y = newo.getYaw().valueRadians();//newo.y;
rot.z = newo.getRoll().valueRadians(); //newo.z;
ptr.getRefData().getBaseNode()->setOrientation(newo);
}
else if(isPlayer)
{
rot.x = mPlayer->getPitch();
rot.z = mPlayer->getYaw();
rot.z = -mPlayer->getYaw();
}
else if (adjust)
{

Loading…
Cancel
Save