bepu / bepuphysics1

Pure C# 3D real time physics simulation library. Repo contains only the 1.X.X versions.
http://www.bepuphysics.com
Apache License 2.0
401 stars 199 forks source link

Box-box special case can have numerical problems when edge axes are nearly aligned. #13

Closed RossNordby closed 3 years ago

RossNordby commented 3 years ago

See https://github.com/bepu/bepuphysics1/discussions/12 for initial report.

The interval test for edge-edge does not check the axis for degeneracy before the test. This can make the result of the interval test a numerical coinflip and prone to incorrect results.

Affects all variants of the BoxBoxCollider tests, apparently.

Workaround, from discussion:

A quick workaround would be to replace the BoxBox handler in the NarrowPhaseHelper. Change https://github.com/bepu/bepuphysics1/blob/master/BEPUphysics/NarrowPhaseSystems/NarrowPhaseHelper.cs#L20 and https://github.com/bepu/bepuphysics1/blob/master/BEPUphysics/NarrowPhaseSystems/NarrowPhaseHelper.cs#L155 to use GeneralConvexPairHandler rather than BoxPairHandler.

RossNordby commented 3 years ago

Should be resolved by #16.