diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/world.cpp index a636ce2887..a1d5824917 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/world.cpp @@ -701,6 +701,7 @@ namespace MWWorld void World::update (float duration) { + getNorthVector(mWorldScene->getCurrentCell()); mWorldScene->update (duration); mWeatherManager->update (duration); @@ -754,4 +755,19 @@ namespace MWWorld { return mRendering->getFader(); } + + Ogre::Vector2 World::getNorthVector(Ptr::CellStore* cell) + { + ESMS::CellRefList statics = cell->statics; + ESMS::LiveCellRef* ref = statics.find("northmarker"); + if (!ref) + { + std::cout << "No north marker found." << std::endl; + return Vector2(0, 1); + } + Ogre::SceneNode* node = ref->mData.getBaseNode(); + Vector3 dir = -node->_getDerivedOrientation().zAxis(); + Vector2 d = Vector2(dir.x, dir.z); + return d; + } } diff --git a/apps/openmw/mwworld/world.hpp b/apps/openmw/mwworld/world.hpp index 71cca3545d..2607c38300 100644 --- a/apps/openmw/mwworld/world.hpp +++ b/apps/openmw/mwworld/world.hpp @@ -129,6 +129,9 @@ namespace MWWorld bool isCellExterior() const; bool isCellQuasiExterior() const; + Ogre::Vector2 getNorthVector(Ptr::CellStore* cell); + ///< get north vector (OGRE coordinates) for given interior cell + Globals::Data& getGlobalVariable (const std::string& name); Globals::Data getGlobalVariable (const std::string& name) const;