I'm doing a little test where I want simulate a repulsion, like a snooker ball shocking with another ball, and/or, a spaceship shocking with a hard spaceship.
The principle is simple, but I can't figure out the math, so, someone can help me, please?
I think this is something known by Mr. @Yann or a Guru of the Math =P
My last try was to compare the center position of the hit ball and the center position of the ball in movement, when one overlap the other ball, they will split the energy.
But how we can change their direction to the right direction? using cos and sen?
Another question, in case of a sprite with squared collision box, how it work?
Some images to illustrate the problem: