diff --git a/apps/launcher/advancedpage.cpp b/apps/launcher/advancedpage.cpp
index b7bf1a2494..683d441193 100644
--- a/apps/launcher/advancedpage.cpp
+++ b/apps/launcher/advancedpage.cpp
@@ -108,6 +108,7 @@ bool Launcher::AdvancedPage::loadSettings()
int numPhysicsThreads = mEngineSettings.getInt("async num threads", "Physics");
if (numPhysicsThreads >= 0)
physicsThreadsSpinBox->setValue(numPhysicsThreads);
+ loadSettingBool(allowNPCToFollowOverWaterSurfaceCheckBox, "allow actors to follow over water surface", "Game");
}
// Visuals
diff --git a/apps/openmw/mwmechanics/aipackage.cpp b/apps/openmw/mwmechanics/aipackage.cpp
index 214aad320b..87ee562c67 100644
--- a/apps/openmw/mwmechanics/aipackage.cpp
+++ b/apps/openmw/mwmechanics/aipackage.cpp
@@ -411,10 +411,15 @@ bool MWMechanics::AiPackage::isReachableRotatingOnTheRun(const MWWorld::Ptr& act
DetourNavigator::Flags MWMechanics::AiPackage::getNavigatorFlags(const MWWorld::Ptr& actor) const
{
+ static const bool allowToFollowOverWaterSurface = Settings::Manager::getBool("allow actors to follow over water surface", "Game");
+
const MWWorld::Class& actorClass = actor.getClass();
DetourNavigator::Flags result = DetourNavigator::Flag_none;
- if (actorClass.isPureWaterCreature(actor) || (getTypeId() != AiPackageTypeId::Wander && actorClass.canSwim(actor)))
+ if (actorClass.isPureWaterCreature(actor)
+ || (getTypeId() != AiPackageTypeId::Wander
+ && ((allowToFollowOverWaterSurface && getTypeId() == AiPackageTypeId::Follow)
+ || actorClass.canSwim(actor))))
result |= DetourNavigator::Flag_swim;
if (actorClass.canWalk(actor))
diff --git a/docs/source/reference/modding/settings/game.rst b/docs/source/reference/modding/settings/game.rst
index 4e1fe13183..878485b3b3 100644
--- a/docs/source/reference/modding/settings/game.rst
+++ b/docs/source/reference/modding/settings/game.rst
@@ -439,3 +439,19 @@ graphic herbalism
Some mods add harvestable container models. When this setting is enabled, activating a container using a harvestable model will visually harvest from it instead of opening the menu.
When this setting is turned off or when activating a regular container, the menu will open as usual.
+
+allow actors to follow over water surface
+---------------------
+
+:Type: boolean
+:Range: True/False
+:Default: True
+
+If enabled actors will always find path over the water surface when following other actors. This makes OpenMW behaviour closer to the vanilla engine.
+
+If disabled actors without the ability to swim will not follow other actors to the water.
+
+.. note::
+ Has effect only when Navigator is enabled.
+
+This setting can be controlled in Advanced tab of the launcher.
diff --git a/files/settings-default.cfg b/files/settings-default.cfg
index 78487b1735..68c27abe5a 100644
--- a/files/settings-default.cfg
+++ b/files/settings-default.cfg
@@ -364,6 +364,10 @@ always allow stealing from knocked out actors = false
# Enables visually harvesting plants for models that support it.
graphic herbalism = true
+# Give actors an ability to swim over water surface when they follow other actor independently from their ability to swim
+# (true, false)
+allow actors to follow over water surface = true
+
[General]
# Anisotropy reduces distortion in textures at low angles (e.g. 0 to 16).
diff --git a/files/ui/advancedpage.ui b/files/ui/advancedpage.ui
index a990e9172f..594372aab7 100644
--- a/files/ui/advancedpage.ui
+++ b/files/ui/advancedpage.ui
@@ -153,6 +153,16 @@
+ -
+
+
+ Give NPC an ability to swim over the water surface when they follow other actor independently from their ability to swim. Has effect only when nav mesh building is enabled.
+
+
+ Always allow NPC to follow over water surface
+
+
+
-