diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index ad64f79d7..b0792a9e5 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1966,6 +1966,7 @@ void CharacterController::update(float duration, bool animationOnly) static const bool smoothMovement = Settings::Manager::getBool("smooth movement", "Game"); if (smoothMovement && !isFirstPersonPlayer) { + static const float playerTurningCoef = 1.0 / std::max(0.01f, Settings::Manager::getFloat("smooth movement player turning delay", "Game")); float angle = mPtr.getRefData().getPosition().rot[2]; osg::Vec2f targetSpeed = Misc::rotateVec2f(osg::Vec2f(vec.x(), vec.y()), -angle) * movementSettings.mSpeedFactor; osg::Vec2f delta = targetSpeed - mSmoothedSpeed; @@ -1975,7 +1976,7 @@ void CharacterController::update(float duration, bool animationOnly) float maxDelta; if (std::abs(speedDelta) < deltaLen / 2) // Turning is smooth for player and less smooth for NPCs (otherwise NPC can miss a path point). - maxDelta = duration * (isPlayer ? 3.f : 6.f); + maxDelta = duration * (isPlayer ? playerTurningCoef : 6.f); else if (isPlayer && speedDelta < -deltaLen / 2) // As soon as controls are released, mwinput switches player from running to walking. // So stopping should be instant for player, otherwise it causes a small twitch. diff --git a/docs/source/reference/modding/settings/game.rst b/docs/source/reference/modding/settings/game.rst index f942f6e7c..fd93eba61 100644 --- a/docs/source/reference/modding/settings/game.rst +++ b/docs/source/reference/modding/settings/game.rst @@ -344,6 +344,17 @@ Recommended to use with "turn to movement direction" enabled. This setting can be controlled in Advanced tab of the launcher. +smooth movement player turning delay +------------------------------------ + +:Type: floating point +:Range: >= 0.01 +:Default: 0.333 + +Max delay of turning (in seconds) if player drastically changes direction on the run. Makes sense only if "smooth movement" is enabled. + +This setting can only be configured by editing the settings configuration file. + NPCs avoid collisions --------------------- diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 3c6e736d8..c5c0ece96 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -328,6 +328,9 @@ turn to movement direction = false # Makes all movements of NPCs and player more smooth. smooth movement = false +# Max delay of turning (in seconds) if player drastically changes direction on the run. +smooth movement player turning delay = 0.333 + # All actors avoid collisions with other actors. NPCs avoid collisions = false