I’ve read through the thread with “the discreet rendering loop” but I still have some questions:
I am programming a physics engine with unlimited forces acting on unlimited numbers of objects in a environment. For each object I am calculating the result of the forces and applying it correctly. This is already working.
But I use for the physics a loop with an interval of 50 ms, which means that it will be calculated 20 times per second. Until now I have a passive rendering mode, which means that I do a repaint() in the physics loop.
What I don’t understand: Even if I would do a rendering loop, the position of the objects won’t change for 50 ms, so what is actually the reason of repainting when there isn’t something new to display ?
When an object reaches a suffisent fast velocity, it changes its position in 50ms for let’s say 20pixels…this means that I will get a sloppy movement animation even if I render at more than 50ms !!!
What am I doing wrong ?
A solution I could imagine would be to move the object in the rendering loop just enough so that it will be a smooth animation…but I don’t know exactly…
The entire code is quite big and I don’t want to annoy you here with bad code.
