mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-01 01:45:34 +00:00
Update doors objects in navigator
This commit is contained in:
parent
661da42bd2
commit
f8dbd5902f
2 changed files with 33 additions and 8 deletions
|
@ -1543,19 +1543,32 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
if(player != results.end())
|
if(player != results.end())
|
||||||
moveObjectImp(player->first, player->second.x(), player->second.y(), player->second.z(), false);
|
moveObjectImp(player->first, player->second.x(), player->second.y(), player->second.z(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void World::updateNavigator()
|
||||||
|
{
|
||||||
|
bool updated = false;
|
||||||
|
|
||||||
bool navigatorObjectsUpdated = false;
|
|
||||||
mPhysics->forEachAnimatedObject([&] (const MWPhysics::Object* object)
|
mPhysics->forEachAnimatedObject([&] (const MWPhysics::Object* object)
|
||||||
|
{
|
||||||
|
updated = updateNavigatorObject(object) || updated;
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const auto& door : mDoorStates)
|
||||||
|
if (const auto object = mPhysics->getObject(door.first))
|
||||||
|
updated = updateNavigatorObject(object) || updated;
|
||||||
|
|
||||||
|
if (updated)
|
||||||
|
mNavigator->update(getPlayerPtr().getRefData().getPosition().asVec3());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool World::updateNavigatorObject(const MWPhysics::Object* object)
|
||||||
{
|
{
|
||||||
const DetourNavigator::ObjectShapes shapes {
|
const DetourNavigator::ObjectShapes shapes {
|
||||||
*object->getShapeInstance()->getCollisionShape(),
|
*object->getShapeInstance()->getCollisionShape(),
|
||||||
object->getShapeInstance()->getAvoidCollisionShape()
|
object->getShapeInstance()->getAvoidCollisionShape()
|
||||||
};
|
};
|
||||||
navigatorObjectsUpdated = mNavigator->updateObject(std::size_t(object), shapes,
|
return mNavigator->updateObject(std::size_t(object), shapes, object->getCollisionObject()->getWorldTransform());
|
||||||
object->getCollisionObject()->getWorldTransform()) || navigatorObjectsUpdated;
|
|
||||||
});
|
|
||||||
if (navigatorObjectsUpdated)
|
|
||||||
mNavigator->update(getPlayerPtr().getRefData().getPosition().asVec3());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool World::castRay (float x1, float y1, float z1, float x2, float y2, float z2, bool ignoreDoors)
|
bool World::castRay (float x1, float y1, float z1, float x2, float y2, float z2, bool ignoreDoors)
|
||||||
|
@ -1747,7 +1760,10 @@ namespace MWWorld
|
||||||
updateWeather(duration, paused);
|
updateWeather(duration, paused);
|
||||||
|
|
||||||
if (!paused)
|
if (!paused)
|
||||||
|
{
|
||||||
doPhysics (duration);
|
doPhysics (duration);
|
||||||
|
updateNavigator();
|
||||||
|
}
|
||||||
|
|
||||||
updatePlayer();
|
updatePlayer();
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,11 @@ namespace ToUTF8
|
||||||
|
|
||||||
struct ContentLoader;
|
struct ContentLoader;
|
||||||
|
|
||||||
|
namespace MWPhysics
|
||||||
|
{
|
||||||
|
class Object;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
class WeatherManager;
|
class WeatherManager;
|
||||||
|
@ -148,6 +153,10 @@ namespace MWWorld
|
||||||
void doPhysics(float duration);
|
void doPhysics(float duration);
|
||||||
///< Run physics simulation and modify \a world accordingly.
|
///< Run physics simulation and modify \a world accordingly.
|
||||||
|
|
||||||
|
void updateNavigator();
|
||||||
|
|
||||||
|
bool updateNavigatorObject(const MWPhysics::Object* object);
|
||||||
|
|
||||||
void ensureNeededRecords();
|
void ensureNeededRecords();
|
||||||
|
|
||||||
void fillGlobalVariables();
|
void fillGlobalVariables();
|
||||||
|
|
Loading…
Reference in a new issue