• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Delta time movement calculation

Gravitr

Lurker
Hi, I would need help;
I have game object which isn't moving in correct speed calculated from deltaTime bellow. It should reach half of the screen in one second, on any device.

Devices tested:
  • tablet A7600-F - deltaTime = 0.03355443; (res. 720x1280)
  • Xperia Z3 Compact - deltaTime = 0.13421772; (res. 720x1280)
Calculation:
calc =(screenWidth /2)* deltaTime. //I have app in landscape mode
speed =Math.round(calc);

- - - - -
Got:
speed on tablet - 21px per update;
speed on xperia - 86px per update;

You can see these results are very different (actualy it should be something about 8px - 20px). Game object is then extreme fast on Xperia (on tablet it's just a bit faster - speed is more than half of the screen per second).

What am I missing?
 
It would be more helpful to see how you're calculating deltaTime and what your gameloop is like, if possible.
 
Back
Top Bottom