Hello, I would like your suggestion about this problem...
To make it simple, I'll consider only the x axis.
Image an object in position 10, and its width also 10 units, which is moving forward 100 units per second, and due to low frame, on each update it should move 80 units.
After the first update is called, its position is now 90 and there is another object of the same size in position 120.
The next update, will move the object to position 170. Considering that I need to implement collision detection, calculating the collision before or after Update, none will work.
Now comes a simple question...
What to do in this case?
Do something like:
Position start = destinationPos - currentPos;
for (int i; i < start; i++)
if (IsColliding(movingObj.Position + i, staticObj))
//do the colliding stuff here
I don't like this solution, it may be okay for this case, but what if you have x, y, z and a lot of moving objects?
Another solution that I thought would be good, but I'm not sure if it's reliable, is to have another thread doing all this calculations in a loop.
This thread would be something like an infinite loop, and on each iteration I would calculate the elapsedTime
which I believe would be very small and keep moving and calculation the collisions, and the rendering thread, which would be much more slower, would get the current state of the objects and just render it.
What you guys think?