Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was an issue in the collision detection code that seems to have been around for quite some time, i.e., even the previous template had the same bug (see the old collisionDetect.h function lines 225-241 that has been unchanged for seven years) as part of the SAT.
The bug manifests in collision points for vertices to faces being computed wrongly (edge-edge works) where the returned result appears to always be the closest vertex to the origin, which is true in some cases but in most it is not. This stems from the 'handleVertexToface' function that is given the vertices of one OBB (described via its transformation matrix) and the difference between the centers of masses of the objects. How this code is supposed to work, I am unsure.
A more correct implementation would be to take the collision normal (which we have access to anyways) and use this normal to project the distance between the vertices (not center of mass) of the colliding object with respect to the center of mass of the collided object and pick the vertex for which this projection is smallest. To implement this we need to change the signature of the function to now take the center of mass as argument, as well as the normal. Implementing the code then is straight forward.
Credit for finding this problem goves to a student https://github.com/TobiasEppacher
This student also developed a simple test case to debug this issue (not shared here as it would require sharing their exercise submission to debug with).