BeRo1985 / kraft

Kraft Physics Engine is an open source Object Pascal physics engine library that can be used in 3D games.
113 stars 22 forks source link

Fix crash in DoNarrowPhase() after removing TKraftShape that has mesh contact. #33

Closed and3md closed 1 year ago

and3md commented 1 year ago

Hi, I found a crash in Kraft when I have mesh collider and I remove TKraftShape from other rigid body that collides with mesh collider. The fix removes MeshContactPair when we remove contact pair.

Where is the crash exactly?

It crashes in DoNarrowPhase() in the mesh contact pair loop when it get pointer to non-existent TKraftShape and tries get ShapeA.ProxyFatWorldAABB^ (if not AABBIntersect(ShapeA.ProxyFatWorldAABB^,ShapeB.ProxyFatWorldAABB^) then begin)

BeRo1985 commented 1 year ago

Applied at https://github.com/BeRo1985/kraft/commit/c0c81d093a1c785730e6bb438ad5891b92e4e307