First frame has a much longer delta time than other frames
Posted
by
Kipras
on Game Development
See other posts from Game Development
or by Kipras
Published on 2013-10-24T17:35:05Z
Indexed on
2013/10/24
22:10 UTC
Read the original article
Hit count: 249
lwjgl
|frame-rate
I had a problem where my AI moved extreme at the first frame and then normal after that. I then figured out it was my delta. It's about 0.016 seconds (60 fps), but the first frame was about 19000 seconds, which is obviously impossible. Does anybody know what might be happening? Also the delta later on likes to oscillate from 0.01 to 0.03, which is, again, crazy.
long time = Sys.getTime() * 1000 / Sys.getTimerResolution();
float delta = (time - lastFrame) / 1000f;
lastFrame = time;
return delta;
That's the delta code.
© Game Development or respective owner