Harold Serrano

View Original

Game Engine Update-Completed GJK and EPA algorithm

It has been a while since I gave an update on my engine. The truth is that I have been working hard on it. I was finally able to get the GJK algorithm and the EPA algorithm to work properly in the game engine.

It took me a while to realize that my GJK implementation was giving erroneous data during the collision. The simplex points were actually reversed. This wrong data was being fed into the EPA algorithm which was giving off erroneous depth penetration and contact normals.

Today, after two months of working on these algorithms, I finally was able to get it them to work. Honestly, these algorithms are very simple to understand and to implement (even easier in 2D), however, they are very tricky to get it right (very tricky in 3D). Moreover, you need a lot of helper functions in order to get these algorithms to work properly. Their concepts are very simple, but their implementation may take you some time.

So what is next? I think I should take a break, but knowing me, I won't. Next in my todo list is to calculate the Time of Impact between objects. I will use this information to prevent objects from penetrating each other during collisions.