1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 21:42:13 +00:00

Update the player's Ptr in mwrender when changing cells

This commit is contained in:
Chris Robinson 2013-07-17 19:11:03 -07:00
parent 1b4cd787a5
commit c7692acb79
4 changed files with 14 additions and 2 deletions

View File

@ -82,8 +82,8 @@ namespace MWRender
mCameraNode->getCreator()->destroySceneNode(mCameraNode);
}
mCameraNode = node;
mCamera->detachFromParent();
mCameraNode->attachObject(mCamera);
if(!mCamera->isAttached())
mCameraNode->attachObject(mCamera);
}
void Camera::updateListener()

View File

@ -303,6 +303,14 @@ RenderingManager::updateObjectCell(const MWWorld::Ptr &old, const MWWorld::Ptr &
}
}
void RenderingManager::updatePlayerPtr(const MWWorld::Ptr &ptr)
{
if(mPlayerAnimation)
mPlayerAnimation->updatePtr(ptr);
if(mCamera->getHandle() == ptr.getRefData().getHandle())
mCamera->attachTo(ptr);
}
void RenderingManager::update (float duration, bool paused)
{
MWBase::World *world = MWBase::Environment::get().getWorld();

View File

@ -127,6 +127,9 @@ public:
/// \param cur Object reference in new cell
void updateObjectCell(const MWWorld::Ptr &old, const MWWorld::Ptr &cur);
/// Specifies an updated Ptr object for the player (used on cell change).
void updatePlayerPtr(const MWWorld::Ptr &ptr);
void update (float duration, bool paused);
void setAmbientColour(const Ogre::ColourValue& colour);

View File

@ -167,6 +167,7 @@ namespace MWWorld
world->getPlayer().setCell(cell);
MWWorld::Ptr player = world->getPlayer().getPlayer();
mRendering.updatePlayerPtr(player);
if (adjustPlayerPos) {
world->moveObject(player, pos.pos[0], pos.pos[1], pos.pos[2]);