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:
parent
1b4cd787a5
commit
c7692acb79
@ -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()
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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]);
|
||||
|
Loading…
Reference in New Issue
Block a user