venerdì 29 luglio 2016

Day 154: SAT

Today I implemented the box - box collision with the SAT theorem.
The idea behind it is to check whether two objects are intersecting when projected onto an axis. If they do on every relevant axis, then they are colliding. The relevant axis are quite a lot: all the axis parallel to each face of the two objects, or to the cross product of each pair of edges. Thankfully for a cube the number of axis to check is just 15 because many of them are duplicated.

Honestly this was the hardest part until now, and I struggled to understand exactly what was going on. In the end I understood almost everything about the SAT, but the real problem was after that: i didn't quite get the function to find the contact point between two colliding edges. I struggle with it quite a bit, then decided to just use it as it is, and go back to focus on it while the engine will be running (i will probably also try to add other pair collisions, like box and point, because I really don't feel confident that I've understood enough of this part, so it will be a good excercise)

Nessun commento:

Posta un commento