I've got an AABB vs triangle collision detection implementation, but I'm running into some precision issues.
When the AABB is moved I compute the time of impact (a float in the range 0.0 - 1.0) and lerp the AABB to that time. I then slide along the triangles sliding plane.
There are two things I'm noticing:
1. Precision issues with the time value. If this value is slightly too large, then it will let the AABB clip through the triangle.
2. Computing the slide vector by projecting the velocity onto the triangles plane sometimes produces a vector that isn't perfectly perpendicular with the triangle, thus collision is detected with the triangle being slid against causing the AABB to get "snagged" as its moving.
These issues are extremely difficult to reproduce but are more prevalent when the frame rate is uncapped and the delta time is extremely small. I could bump into a wall N times with collision and then have it break on the Nth + 1 time. I notice more precision issues against triangles with planes oriented in directions other then the primary axis e.g. (1, 0, 0), (0, 1, 0), (0, 0, 1) work fine.
What are some techniques for avoiding or correcting these issues and getting more deterministic behavior?
Also, what are good tips for debugging and unit testing these issues?