Collisions in Fantastic Bits

How did you find the collisioon with bludgers in Fantastic Bits contest and escape from it ?

For me an article written by Magus about a previous contest was very helpful to detect possible collisions:

I’m writing a post mortem for fantastic bits explaining this things. Waiting this, i can do the very short explanations:

Line 504 : Detection of a collision between 2 Units


This will be pure gold.

The collision detection itself is one thing - the code posted above by Magus does it very efficiently. If you don’t understand the mathematics behind it or find it hard to read due to the lack of any 2D vector class being used, I would recommend the following article:

Following it point by point might not give as optimized results as Magus’ solution, but it might help as a starting point to understand the problem and how to approach it. Which then again might help to understand a more optimized solution.


Thank you so much @Magus and the other friends.