Actually rotate the object when updating physics

actorid
Chris Robinson 12 years ago
parent b6f2b39a2f
commit 18e8ff7198

@ -806,13 +806,8 @@ namespace MWWorld
mPhysics->scaleObject(ptr);
}
void World::rotateObject (const Ptr& ptr,float x,float y,float z, bool adjust)
void World::rotateObjectImp (const Ptr& ptr, Ogre::Vector3 rot, bool adjust)
{
Ogre::Vector3 rot;
rot.x = Ogre::Degree(x).valueRadians();
rot.y = Ogre::Degree(y).valueRadians();
rot.z = Ogre::Degree(z).valueRadians();
if (mRendering->rotateObject(ptr, rot, adjust))
{
// rotate physically iff renderer confirm so
@ -827,6 +822,14 @@ namespace MWWorld
}
}
void World::rotateObject (const Ptr& ptr,float x,float y,float z, bool adjust)
{
rotateObjectImp(ptr, Ogre::Vector3(Ogre::Degree(x).valueRadians(),
Ogre::Degree(y).valueRadians(),
Ogre::Degree(z).valueRadians()),
adjust);
}
void World::safePlaceObject(const MWWorld::Ptr& ptr,MWWorld::CellStore &Cell,ESM::Position pos)
{
copyObjectToCell(ptr,Cell,pos);
@ -876,12 +879,17 @@ namespace MWWorld
player = iter;
continue;
}
rotateObjectImp(iter->first, Ogre::Vector3(iter->second.mRotation), true);
Ogre::Vector3 vec = mPhysics->move(iter->first, Ogre::Vector3(iter->second.mPosition), duration,
!isSwimming(iter->first) && !isFlying(iter->first));
moveObjectImp(iter->first, vec.x, vec.y, vec.z);
}
if(player != actors.end())
{
rotateObjectImp(player->first, Ogre::Vector3(player->second.mRotation), true);
Ogre::Vector3 vec = mPhysics->move(player->first, Ogre::Vector3(player->second.mPosition), duration,
!isSwimming(player->first) && !isFlying(player->first));
moveObjectImp(player->first, vec.x, vec.y, vec.z);

@ -90,6 +90,8 @@ namespace MWWorld
int getDaysPerMonth (int month) const;
void rotateObjectImp (const Ptr& ptr, Ogre::Vector3 rot, bool adjust);
bool moveObjectImp (const Ptr& ptr, float x, float y, float z);
///< @return true if the active cell (cell player is in) changed

Loading…
Cancel
Save