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:
<img src="http://upload.wikimedia.org/wikipedia/commons/2/2c/Elastischer_sto%C3%9F_2D.gif" border="0" />
<img src="http://s3.amazonaws.com/magoo/ABAAAenlYAB-0.png" border="0" />
<img src="http://www.feiradeciencias.com.br/sala05/image05/05_Q4_01.gif" border="0" />