Fix multiccd edge bug that occurs in certain situations.

PiperOrigin-RevId: 922251109
Change-Id: I74c08ae49d5dfd2a41b2dcd28eb9f2b5ba113216
This commit is contained in:
Kyle Bayes
2026-05-27 11:31:53 -07:00
committed by Copybara-Service
parent f6c85287bf
commit 4035c66428
2 changed files with 47 additions and 1 deletions
+9 -1
View File
@@ -2169,8 +2169,16 @@ static void multicontact(Polytope* pt, Face* face, mjCCDStatus* status,
// face1 is an edge; clip face1 against face2
if (edgecon1) {
scl3(approx_dir, n2 + 3*j, norm3(dir));
scl3(approx_dir, n2 + 3*j, -norm3(dir));
polygonClip(status, face2, nface2, face1, nface1, n2 + 3*j, approx_dir);
// x1 and x2 must be flipped as we flipped the faces in polygonClip
int nx = status->nx;
for (int k = 0; k < nx; k++) {
mjtNum tmp[3];
copy3(tmp, status->x1 + 3*k);
copy3(status->x1 + 3*k, status->x2 + 3*k);
copy3(status->x2 + 3*k, tmp);
}
return;
}