As whats in the title i was wondering what dt actually means in the context of the update function?
1 Like
Delta time. Time since the last frame. If the game runs at a stable 60 fps, then it would be 1/60th of a second each frame.
3 Likes
To add a bit more information. The update function is ran every frame and it can vary how many you get per seconds. The dt
value is useful for calculating something to take seconds and therefore being the same speed regardless of how fast your frame renders.
If you have a character that you want to change position on you would do something like position = position + direction * speed * dt
the last dt
here scales it to be “per second” instead of “per frame”.
6 Likes
Very useful additional information!
Small note, it would be position + direction [etc], not position * direction.
2 Likes