Hello,
I've a little problem of logic in a game i'm currently working on.
I've vX += acceleration * dT which represent the velocity in X
and x += vX * dT;
I've done so because of the reading of book. But after thinking about it and tying with values It seams not really accurate:
imagine acceleration = 1 and two computers A with dT = 1s and B with dt = 2s.
With A:
at the beginning vX = x = 0;
vX += 1 * 1; // = 1
x += 1 * 1; // = 1
vX += 1 * 1; // = 2
x += 2 * 1; // = 3
vX += 1 * 1; // = 3
x += 6 * 1; // = 6
so at 1s x = 1 px
at 2s x = 3 px
at 3s x = 6 px
at 4s x = 10 px
With B:
vX += 1 * 2; // = 2
x += 2 * 2; // = 4
vX += 1 * 2; // = 4
x += 4 * 2; // = 12
so at 2s x = 4 px
at 4s x = 12 px
So here we clearly see that at 4s both x values are not at the same position, wich is clearly not ideal for my gameplay.
Any Idea on what should be really done ?
Thx