1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 07:53:51 +00:00

More physics and managing of Animation objects

This commit is contained in:
Jason Hooks 2011-12-25 01:52:57 -05:00
parent 1b835d6702
commit 7eee54bcd7
3 changed files with 17 additions and 13 deletions

View file

@ -45,9 +45,16 @@ namespace MWClass
const std::string &model = ref->base->model; const std::string &model = ref->base->model;
assert (ref->base != NULL); assert (ref->base != NULL);
if(!model.empty()){ std::string headID = ref->base->head;
physics.insertActorPhysics(ptr, "meshes\\" + model); std::string bodyRaceID = headID.substr(0, headID.find_last_of("head_") - 4);
} bool beast = bodyRaceID == "b_n_khajiit_m_" || bodyRaceID == "b_n_khajiit_f_" || bodyRaceID == "b_n_argonian_m_" || bodyRaceID == "b_n_argonian_f_";
std::string smodel = "meshes\\base_anim.nif";
if(beast)
smodel = "meshes\\base_animkna.nif";
physics.insertActorPhysics(ptr, smodel);
} }

View file

@ -98,18 +98,15 @@ void Actors::removeCell(MWWorld::Ptr::CellStore* store){
{ {
Ogre::SceneNode* base = mCellSceneNodes[store]; Ogre::SceneNode* base = mCellSceneNodes[store];
base->removeAndDestroyAllChildren(); base->removeAndDestroyAllChildren();
mCellSceneNodes.erase(store); mCellSceneNodes.erase(store);
mRend.getScene()->destroySceneNode(base); mRend.getScene()->destroySceneNode(base);
base = 0; base = 0;
} }
for(std::map<MWWorld::Ptr, Animation*>::iterator iter = mAllActors.begin(); iter != mAllActors.end(); iter++)
{
if(iter->first.getCell() == store){
mAllActors.erase(iter);
}
}
} }

View file

@ -191,7 +191,7 @@ namespace MWWorld
void PhysicsSystem::insertActorPhysics(const MWWorld::Ptr& ptr, const std::string model){ void PhysicsSystem::insertActorPhysics(const MWWorld::Ptr& ptr, const std::string model){
Ogre::SceneNode* node = ptr.getRefData().getBaseNode(); Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
std::cout << "Adding node with name" << node->getName(); // std::cout << "Adding node with name" << node->getName();
addActor (node->getName(), model, node->getPosition()); addActor (node->getName(), model, node->getPosition());
} }