mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Enable collision for postponed objects when any object is disabled
This commit is contained in:
parent
e40461a8e3
commit
aa2fab8db5
@ -575,26 +575,7 @@ namespace MWWorld
|
|||||||
return cellsPositionsToLoad;
|
return cellsPositionsToLoad;
|
||||||
};
|
};
|
||||||
|
|
||||||
for(const auto& cell : mActiveCells)
|
addPostponedPhysicsObjects();
|
||||||
{
|
|
||||||
cell->forEach([&](const MWWorld::Ptr& ptr)
|
|
||||||
{
|
|
||||||
if(ptr.mRef->mData.mPhysicsPostponed)
|
|
||||||
{
|
|
||||||
ptr.mRef->mData.mPhysicsPostponed = false;
|
|
||||||
if (ptr.mRef->mData.isEnabled() && ptr.mRef->mData.getCount() > 0)
|
|
||||||
{
|
|
||||||
std::string model = getModel(ptr, MWBase::Environment::get().getResourceSystem()->getVFS());
|
|
||||||
if (!model.empty())
|
|
||||||
{
|
|
||||||
const auto rotation = makeNodeRotation(ptr, RotationOrder::direct);
|
|
||||||
ptr.getClass().insertObjectPhysics(ptr, model, rotation, *mPhysics);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
auto cellsPositionsToLoad = cellsToLoad(mActiveCells,mHalfGridSize);
|
auto cellsPositionsToLoad = cellsToLoad(mActiveCells,mHalfGridSize);
|
||||||
|
|
||||||
@ -637,6 +618,30 @@ namespace MWWorld
|
|||||||
mNavigator.wait(*loadingListener, DetourNavigator::WaitConditionType::requiredTilesPresent);
|
mNavigator.wait(*loadingListener, DetourNavigator::WaitConditionType::requiredTilesPresent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Scene::addPostponedPhysicsObjects()
|
||||||
|
{
|
||||||
|
for(const auto& cell : mActiveCells)
|
||||||
|
{
|
||||||
|
cell->forEach([&](const MWWorld::Ptr& ptr)
|
||||||
|
{
|
||||||
|
if(ptr.mRef->mData.mPhysicsPostponed)
|
||||||
|
{
|
||||||
|
ptr.mRef->mData.mPhysicsPostponed = false;
|
||||||
|
if (ptr.mRef->mData.isEnabled() && ptr.mRef->mData.getCount() > 0)
|
||||||
|
{
|
||||||
|
std::string model = getModel(ptr, MWBase::Environment::get().getResourceSystem()->getVFS());
|
||||||
|
if (!model.empty())
|
||||||
|
{
|
||||||
|
const auto rotation = makeNodeRotation(ptr, RotationOrder::direct);
|
||||||
|
ptr.getClass().insertObjectPhysics(ptr, model, rotation, *mPhysics);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Scene::testExteriorCells()
|
void Scene::testExteriorCells()
|
||||||
{
|
{
|
||||||
// Note: temporary disable ICO to decrease memory usage
|
// Note: temporary disable ICO to decrease memory usage
|
||||||
|
@ -174,6 +174,8 @@ namespace MWWorld
|
|||||||
void removeObjectFromScene (const Ptr& ptr, bool keepActive = false);
|
void removeObjectFromScene (const Ptr& ptr, bool keepActive = false);
|
||||||
///< Remove an object from the scene, but not from the world model.
|
///< Remove an object from the scene, but not from the world model.
|
||||||
|
|
||||||
|
void addPostponedPhysicsObjects();
|
||||||
|
|
||||||
void removeFromPagedRefs(const Ptr &ptr);
|
void removeFromPagedRefs(const Ptr &ptr);
|
||||||
|
|
||||||
void updateObjectRotation(const Ptr& ptr, RotationOrder order);
|
void updateObjectRotation(const Ptr& ptr, RotationOrder order);
|
||||||
|
@ -881,7 +881,10 @@ namespace MWWorld
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(mWorldScene->getActiveCells().find (reference.getCell())!=mWorldScene->getActiveCells().end() && reference.getRefData().getCount())
|
if(mWorldScene->getActiveCells().find (reference.getCell())!=mWorldScene->getActiveCells().end() && reference.getRefData().getCount())
|
||||||
|
{
|
||||||
mWorldScene->removeObjectFromScene (reference);
|
mWorldScene->removeObjectFromScene (reference);
|
||||||
|
mWorldScene->addPostponedPhysicsObjects();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::advanceTime (double hours, bool incremental)
|
void World::advanceTime (double hours, bool incremental)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user