Skip to content

Commit

Permalink
Separating case: closest triangle normal not equal to collision normal
Browse files Browse the repository at this point in the history
  • Loading branch information
notgiven688 committed Oct 2, 2024
1 parent 4a8dad3 commit d283167
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/GJKEPA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ public bool Solve(out JVector point1, out JVector point2, out JVector normal, ou
point1 = bc.X * VerticesA[ctri.A] + bc.Y * VerticesA[ctri.B] + bc.Z * VerticesA[ctri.C];
point2 = bc.X * VerticesB[ctri.A] + bc.Y * VerticesB[ctri.B] + bc.Z * VerticesB[ctri.C];

normal = ctri.Normal * (1.0d / Math.Sqrt(ctri.NormalSq));
if (Math.Abs(separation) > NumericEpsilon) normal = -ctri.ClosestToOrigin * (1.0f / separation);
else normal = ctri.Normal * (1.0f / Math.Sqrt(ctri.NormalSq));

return true;
}
Expand Down

0 comments on commit d283167

Please sign in to comment.