diff options
-rw-r--r-- | intern/elbeem/intern/ntl_world.cpp | 8 | ||||
-rw-r--r-- | intern/elbeem/intern/ntl_world.h | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/intern/elbeem/intern/ntl_world.cpp b/intern/elbeem/intern/ntl_world.cpp index dcc81dbe5cb..9ae5135b040 100644 --- a/intern/elbeem/intern/ntl_world.cpp +++ b/intern/elbeem/intern/ntl_world.cpp @@ -420,7 +420,12 @@ int ntlWorld::advanceSims(int framenum) // Was: double targetTime = mSimulationTime + (*mpSims)[mFirstSim]->getFrameTime(framenum); - DG double totalTime = 0.0, targetTime = 0.0; for(size_t i = 0; i < mSimFrameCnt; i++) - totalTime += (*mpSims)[mFirstSim]->getFrameTime(framenum); + { + /* We need an intermediate array "mSimFrameValue" because + otherwise if we don't start with starttime = 0, + the sim gets out of sync - DG */ + totalTime += (*mpSims)[mFirstSim]->getFrameTime(mSimFrameValue[i]); + } targetTime = totalTime + (*mpSims)[mFirstSim]->getFrameTime(framenum); int gstate = 0; @@ -468,6 +473,7 @@ int ntlWorld::advanceSims(int framenum) sim->prepareVisualization(); } + mSimFrameValue.push_back(framenum); mSimFrameCnt++; return 0; diff --git a/intern/elbeem/intern/ntl_world.h b/intern/elbeem/intern/ntl_world.h index c207904cf75..6cec098132b 100644 --- a/intern/elbeem/intern/ntl_world.h +++ b/intern/elbeem/intern/ntl_world.h @@ -118,6 +118,7 @@ class ntlWorld /*! count no. of frame for correct sim time */ int mSimFrameCnt; + vector<int> mSimFrameValue; }; |