Skip to content

Commit

Permalink
Guard against overflowing the contact manifold
Browse files Browse the repository at this point in the history
  • Loading branch information
notgiven688 committed Nov 8, 2024
1 parent 541f6b0 commit da07052
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Jitter2/World.Detect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ static void Support(RigidBodyShape shape, in JVector direction, out JVector v)
float diff = JVector.Dot(p - pB, normal);
mB[manifoldCount] = p;
mA[manifoldCount++] = p - (diff - penetration) * normal;

if (manifoldCount == 6) return;
}
}
}
Expand Down Expand Up @@ -193,6 +195,8 @@ static void Support(RigidBodyShape shape, in JVector direction, out JVector v)
float diff = -JVector.Dot(p - pA, normal);
mA[manifoldCount] = p;
mB[manifoldCount++] = p - (diff - penetration) * normal;

if (manifoldCount == 6) return;
}
}
}
Expand Down

0 comments on commit da07052

Please sign in to comment.