Physics sort of fixed

This commit is contained in:
Jason Hooks 2012-01-29 17:50:51 -05:00
parent 1da519a914
commit 9c73fa6b6d
3 changed files with 17 additions and 7 deletions

View file

@ -60,12 +60,12 @@ namespace MWWorld
std::cout << "Unloading cell\n";
ListHandles functor;
MWWorld::Ptr::CellStore* active = *iter;
active->forEach<ListHandles>(functor);
(*iter)->forEach<ListHandles>(functor);
{
@ -77,12 +77,13 @@ namespace MWWorld
mPhysics->removeObject (node->getName());
}
}
mRendering.removeCell(active);
mRendering.removeCell(*iter);
//mPhysics->removeObject("Unnamed_43");
mWorld->getLocalScripts().clearCell (active);
mEnvironment.mMechanicsManager->dropActors (active);
mEnvironment.mSoundManager->stopSound (active);
mActiveCells.erase(active);
mWorld->getLocalScripts().clearCell (*iter);
mEnvironment.mMechanicsManager->dropActors (*iter);
mEnvironment.mSoundManager->stopSound (*iter);
mActiveCells.erase(*iter);
}
@ -108,6 +109,7 @@ namespace MWWorld
void Scene::playerCellChange (Ptr::CellStore *cell, const ESM::Position& position,
bool adjustPlayerPos)
{
mWorld->makeNewPlayer();
if (adjustPlayerPos)
mWorld->getPlayer().setPos (position.pos[0], position.pos[1], position.pos[2]);

View file

@ -182,6 +182,13 @@ namespace MWWorld
}
void World::makeNewPlayer(){
MWRender::Player* play = &(mRendering.getPlayer());
delete mPlayer;
mPlayer = new MWWorld::Player (play, mStore.npcs.find ("player"), *this);
mPhysics->addActor (mPlayer->getPlayer().getRefData().getHandle(), "", Ogre::Vector3 (0, 0, 0));
}
World::~World()
{
delete mWorldScene;

View file

@ -220,6 +220,7 @@ namespace MWWorld
/// references that are currently not in the rendered scene should be ignored.
void setObjectPhysicsRotation(const std::string& handle,Ogre::Quaternion quat);
void setObjectPhysicsPosition(const std::string& handle,Ogre::Vector3 vector);
void makeNewPlayer();
};
}