Sunday, 8 September 2013

How to fix circles overlap in collision response?

How to fix circles overlap in collision response?

Since in the digital world a real collision almost never happens, we will
always have a situation where the "colliding" balls overlap. How to put
back balls in situation where they collide perfectly without overlap?
I would solve this problem with a posteriori approach (in two dimensions).
In short I have to solve this equation for t:
((x2 - t * v.x2) - (x1 - t * v.x1))^2 - ((y2 - t * v.y2) - (y1 - t *
v.y1))^2 = (r1 + r2)^2
Where:
(x1, y1) is the center of the first ball
(x2, y2) is the center of the second ball
(v.x1, v.y1) and (v.x2, v.y2) are their velocities.
but the solution from WolframAlpha is too complicated (I changed the name
of the variables but essentially does not change anything).

No comments:

Post a Comment