Just to clear some things
- i know how to detect collision
- i do not want a bounce effect since i am not working with velocity
so lets say i have 2 circles C1 and C2. C1 can not be moved, and is stationary. C2 moves into C1. Therefore C2 gets pushed back, but how do i calculate what C2's new center points Coordinates should be?
https://i.stack.imgur.com/GfjpH.png so it is basically going from picture 2 to picture 3
One solution might be as follows:
Let $d $ denote the distance between the circle's centers and $r,R $ be the circles' radius.
If they are overlapping, $d < r + R $.
Draw a line connecting the two centers and slide the circles' centers, along that line, until $d = r + R $.
Depending on what you want, you may move just one of the circles by a distance of $r + R - d $, or both of them. If you move both, you could move both of them the same distance, or proportionally to (the inverse of) their size, for example.