mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-11-29 00:04:32 +00:00
Merge branch 'fix_navmesh_update' into 'master'
Fix navmesh update on opening/closing door See merge request OpenMW/openmw!995 (cherry picked from commit 9123db3a5954dd082f501151cba0a08bfe3ff908) c7c0d11c Trigger navmesh update when any navigator object has been updated
This commit is contained in:
parent
109a7c3daf
commit
dfacaa3711
2 changed files with 12 additions and 14 deletions
|
|
@ -1223,7 +1223,7 @@ namespace MWWorld
|
||||||
if (movePhysics)
|
if (movePhysics)
|
||||||
{
|
{
|
||||||
if (const auto object = mPhysics->getObject(ptr))
|
if (const auto object = mPhysics->getObject(ptr))
|
||||||
updateNavigatorObject(object);
|
updateNavigatorObject(*object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1282,7 +1282,7 @@ namespace MWWorld
|
||||||
if (mPhysics->getActor(ptr))
|
if (mPhysics->getActor(ptr))
|
||||||
mNavigator->addAgent(getPathfindingHalfExtents(ptr));
|
mNavigator->addAgent(getPathfindingHalfExtents(ptr));
|
||||||
else if (const auto object = mPhysics->getObject(ptr))
|
else if (const auto object = mPhysics->getObject(ptr))
|
||||||
mShouldUpdateNavigator = updateNavigatorObject(object) || mShouldUpdateNavigator;
|
updateNavigatorObject(*object);
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::rotateObjectImp(const Ptr& ptr, const osg::Vec3f& rot, MWBase::RotationFlags flags)
|
void World::rotateObjectImp(const Ptr& ptr, const osg::Vec3f& rot, MWBase::RotationFlags flags)
|
||||||
|
|
@ -1331,7 +1331,7 @@ namespace MWWorld
|
||||||
mWorldScene->updateObjectRotation(ptr, order);
|
mWorldScene->updateObjectRotation(ptr, order);
|
||||||
|
|
||||||
if (const auto object = mPhysics->getObject(ptr))
|
if (const auto object = mPhysics->getObject(ptr))
|
||||||
updateNavigatorObject(object);
|
updateNavigatorObject(*object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1423,7 +1423,7 @@ namespace MWWorld
|
||||||
mPhysics->updateRotation(ptr);
|
mPhysics->updateRotation(ptr);
|
||||||
|
|
||||||
if (const auto object = mPhysics->getObject(ptr))
|
if (const auto object = mPhysics->getObject(ptr))
|
||||||
updateNavigatorObject(object);
|
updateNavigatorObject(*object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1543,14 +1543,11 @@ namespace MWWorld
|
||||||
|
|
||||||
void World::updateNavigator()
|
void World::updateNavigator()
|
||||||
{
|
{
|
||||||
mPhysics->forEachAnimatedObject([&] (const MWPhysics::Object* object)
|
mPhysics->forEachAnimatedObject([&] (const MWPhysics::Object* object) { updateNavigatorObject(*object); });
|
||||||
{
|
|
||||||
mShouldUpdateNavigator = updateNavigatorObject(object) || mShouldUpdateNavigator;
|
|
||||||
});
|
|
||||||
|
|
||||||
for (const auto& door : mDoorStates)
|
for (const auto& door : mDoorStates)
|
||||||
if (const auto object = mPhysics->getObject(door.first))
|
if (const auto object = mPhysics->getObject(door.first))
|
||||||
mShouldUpdateNavigator = updateNavigatorObject(object) || mShouldUpdateNavigator;
|
updateNavigatorObject(*object);
|
||||||
|
|
||||||
if (mShouldUpdateNavigator)
|
if (mShouldUpdateNavigator)
|
||||||
{
|
{
|
||||||
|
|
@ -1559,13 +1556,14 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool World::updateNavigatorObject(const MWPhysics::Object* object)
|
void 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()
|
||||||
};
|
};
|
||||||
return mNavigator->updateObject(DetourNavigator::ObjectId(object), shapes, object->getTransform());
|
mShouldUpdateNavigator = mNavigator->updateObject(DetourNavigator::ObjectId(&object), shapes, object.getTransform())
|
||||||
|
|| mShouldUpdateNavigator;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MWPhysics::RayCastingInterface* World::getRayCasting() const
|
const MWPhysics::RayCastingInterface* World::getRayCasting() const
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ namespace MWWorld
|
||||||
|
|
||||||
void updateNavigator();
|
void updateNavigator();
|
||||||
|
|
||||||
bool updateNavigatorObject(const MWPhysics::Object* object);
|
void updateNavigatorObject(const MWPhysics::Object& object);
|
||||||
|
|
||||||
void ensureNeededRecords();
|
void ensureNeededRecords();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue