diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2015-03-16 12:12:29 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2015-03-16 12:12:37 +0300 |
commit | 30527e3e55a1125574265607a8c53acaae1f526c (patch) | |
tree | f5a09cf15c5732401fe7de7fe6190c5571fc5ff5 /source/gameengine/Physics | |
parent | 6aaedc7cfd3e2efdeb1cf42e8c5c7a1c303e42d8 (diff) |
Fix T43178: BGE has hard-coded 60 Hz as frame rate
Two areas of the BGE use a hard-coded 60 Hz as frame rate. However, this 60 Hz is just a default setting, and can be changed in the Blender interface.
This setting is now used instead of the hard-coded 60 Hz.
CcdPhysicsEnvironment::SetFixedTimeStep() is actually never called, as we don't even support a true fixed-timestep simulation.
Diffstat (limited to 'source/gameengine/Physics')
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp index ac74029fbe3..c0aaefe9e37 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp @@ -752,8 +752,8 @@ public: void CcdPhysicsEnvironment::ProcessFhSprings(double curTime,float interval) { std::set<CcdPhysicsController*>::iterator it; - // dynamic of Fh spring is based on a timestep of 1/60 - int numIter = (int)(interval*60.0001f); + // Add epsilon to the tick rate for numerical stability + int numIter = (int)(interval*(KX_KetsjiEngine::GetTicRate() + 0.001f)); for (it=m_controllers.begin(); it!=m_controllers.end(); it++) { diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h index ff8a3f4f9f9..009eb5cde24 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h +++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h @@ -22,6 +22,8 @@ subject to the following restrictions: #define __CCDPHYSICSENVIRONMENT_H__ #include "PHY_IPhysicsEnvironment.h" +#include "KX_KetsjiEngine.h" + #include <vector> #include <set> #include <map> @@ -131,8 +133,7 @@ protected: virtual void SetFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep) { - //based on DEFAULT_PHYSICS_TIC_RATE of 60 hertz - SetNumTimeSubSteps((int)(fixedTimeStep / 60.f)); + SetNumTimeSubSteps((int)(fixedTimeStep / KX_KetsjiEngine::GetTicRate())); } //returns 0.f if no fixed timestep is used |