Keep Update() from advancing by very large chunks; use more double math

This commit is contained in:
Colin McMillen 2020-03-11 11:12:14 -04:00
parent 4346f20024
commit c08defc656

View File

@ -107,9 +107,11 @@ namespace SemiColinGames {
} }
if (!paused) { if (!paused) {
float modelTime = (float) gameTime.ElapsedGameTime.TotalSeconds; double modelTime = gameTime.ElapsedGameTime.TotalSeconds;
// To prevent huge diffs, never update by more than 4 frames' worth of time.
modelTime = Math.Min(modelTime, TARGET_FRAME_TIME * 4.0f);
Clock.AddModelTime(modelTime); Clock.AddModelTime(modelTime);
world.Update(modelTime, input); world.Update((float) modelTime, input);
} }
base.Update(gameTime); base.Update(gameTime);