forked from mirror/openmw-tes3mp
Make physics framerate configurable
This commit is contained in:
parent
0e648222b8
commit
6062cd4b9c
3 changed files with 23 additions and 1 deletions
|
@ -24,6 +24,7 @@
|
|||
#include <components/esm/loadgmst.hpp>
|
||||
#include <components/sceneutil/positionattitudetransform.hpp>
|
||||
#include <components/sceneutil/unrefqueue.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include <components/nifosg/particle.hpp> // 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);
|
||||
|
|
13
docs/source/reference/modding/settings/physics.rst
Normal file
13
docs/source/reference/modding/settings/physics.rst
Normal file
|
@ -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!
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue