A classic Mistake!

I just implemented a classic elastic collision formula to get a semi realistic collision modeling amongst the asteroids in my take of the 1979 Asteroids game.


This is the formula where the u vectors are the speeds before the collision, the v vectors the speeds after the collision and the m numbers are the masses.

I had implemented this correctly, but just made a tiny little mistake, the distance needed between two objects for them not to touch was calculated a little to small, causing the asteroids to linger almost on top of each other when colliding. After fixing this it looks a little better. Try it out HERE! 🙂