Incorrect triangle-triangle collision detected in GI
Posted: Wed Jan 29, 2025 10:17 am
Hi all! We're using gimpact for mesh-to-mesh collisions and have come across a case where two triangles are detecting a false positive collision. I've managed to isolate this pretty well to the two triangles in the STL file linked and pictured below - as you can see these aren't colliding, but are reported as a collision.
https://gist.github.com/ajshort/f032837 ... 60d66acffa
I've made some minimal code inside the btGImpactCollisionAlgorithm class below which reports a collision between these two triangles manually defined. Does anyone have any advice or idea as to the cause? Also if I define "BULLET_TRIANGLE_COLLISION" so the GJK rather than SAT implementation is used, the result is as expected.
https://gist.github.com/ajshort/f032837 ... 60d66acffa
I've made some minimal code inside the btGImpactCollisionAlgorithm class below which reports a collision between these two triangles manually defined. Does anyone have any advice or idea as to the cause? Also if I define "BULLET_TRIANGLE_COLLISION" so the GJK rather than SAT implementation is used, the result is as expected.
Code: Select all
btPrimitiveTriangle ta;
ta.m_vertices[0] = btVector3(4049.92, 12169.6, 2252.3);
ta.m_vertices[1] = btVector3(4083.47, 12166.3, 2258.52);
ta.m_vertices[2] = btVector3(4050.78, 12191, 2238.16);
ta.buildTriPlane();
btPrimitiveTriangle tb;
tb.m_vertices[0] = btVector3(5189.17, 11358, 500.004);
tb.m_vertices[1] = btVector3(3162.31, 11358, 2724.61);
tb.m_vertices[2] = btVector3(3162.31, 12642, 2724.61);
tb.buildTriPlane();
GIM_TRIANGLE_CONTACT gtc;
if (ta.overlap_test_conservative(tb) && ta.find_triangle_collision_clip_method(tb, gtc)) {
std::cout << "A collision has been detected using SAT method" << std::endl;
} else {
std::cout << "No collision detected using SAT method" << std::endl;
}