What is a Delta time in LIBGDX? I read many posts regarding that. To my knowledge, Delta time is,
- The time gap between previous and current frame
- delta time will add upto 1 since its the computation of x frames per second ie.(1/x of the frames)
To make the speed constant for the game we use dt
If we say 60 *dt then it will move 60 frames per second, no matter what the speed of the mobile(for instance) is.
So, this is what I know about delta time but I am not getting a clear view about it because , be it for an update or render method we are passing the delta time but where in the code we are specifying to calculate for PER SECOND?
For example,
public void update(float dt)
{
float distance +=2*dt;
}
will this code move 2 frames per second? If so then what the below code will do?
public void update(float dt)
{
....
}
public void render(float delta)
{
update(delta);
}
so, I need answers for,
- what the above code is implying??
- What's actually happening behind the code?
- Why are we doing so?
where in this code we are specifying it must move x frames per second like the previous above example?
I can understand the render method is passing the delta time to the update method but I need some clear view about it. Sorry if the question seems stupid but it's really hard to proceed without actually knowing what's happening .Any help would be great !!