In the real world, time move continuously.
However, we can not do the calculation continuously. It is always a finite time step (no matter how small it might be).
The time step dt is the same during the simulation.
However, collision often occurred in between time steps (between time t to t+dt).
We tried to detect if two object overlap each to know colllision should have occurred.
Then, we need to find the exact time when collision occurred.
If this 2D collision, we use an approximation method to find the time when collision occurred.
Support the rasius of two particles are r1 and r2, and the distance between two center is d.
And the relative velocity along two center is vp,
then we move back time step ddt=(d-(r1+r2))/vp to find the time collision occurred.
(The above approximation is only good if the relative velocity is small enrough, i.e. vp*dt<
After we take care of collision, we need to move time forward ddt again.