diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index ee368ad24..068ff3186 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include // FindRecIndexVisitor @@ -1357,7 +1358,11 @@ namespace MWPhysics mMovementResults.clear(); mTimeAccum += dt; - const float physicsDt = 1.f/60.0f; + + static const float physFramerate = Settings::Manager::getFloat("physics framerate", "Physics"); + + // Allow to use a physics framerate between 10 and 60 FPS + static const float physicsDt = 1.f / std::max(10.f, std::min(60.f, physFramerate)); const int maxAllowedSteps = 20; int numSteps = mTimeAccum / (physicsDt); diff --git a/docs/source/reference/modding/settings/physics.rst b/docs/source/reference/modding/settings/physics.rst new file mode 100644 index 000000000..e4f970a79 --- /dev/null +++ b/docs/source/reference/modding/settings/physics.rst @@ -0,0 +1,13 @@ +Physics Settings +################ + +physics framerate +--------------- + +:Type: floating point +:Range: 10.0 to 60.0 +:Default: 60.0 + +Allows to set how frequently an engine will do physics calculations. A default value is 60 times per second. +This setting allows developers with low-clocked CPUs to test an engine. +Changing from default value can lead to physics bugs. Change this setting on your own risk, and reset a value to default before filling a physics-related bugreport! diff --git a/files/settings-default.cfg b/files/settings-default.cfg index aec667a9c..f4c7f0a4a 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -277,6 +277,10 @@ camera y multiplier = 1.0 # Invert the vertical axis while not in GUI mode. invert y axis = false +[Physics] +# Framerate of the physics system +physics framerate = 60.0 + [Saves] # Name of last character played, and default for loading save files.