From 941a4409963222af7493ff159daef32b69a5b6c5 Mon Sep 17 00:00:00 2001 From: Riordan Date: Sat, 15 Jan 2022 09:03:08 +1000 Subject: [PATCH] Added recovery vector to shape position before bullet penetration detection to prevent recovery vector from adding repeat penetration responses. --- modules/bullet/space_bullet.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index 6ac1b5406446..8e13146799d9 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -1290,6 +1290,8 @@ bool SpaceBullet::RFP_convex_convex_test(const btConvexShape *p_shapeA, const bt // Initialize GJK input btGjkPairDetector::ClosestPointInput gjk_input; gjk_input.m_transformA = p_transformA; + // Avoid repeat penetrations + gjk_input.m_transformA.getOrigin() += r_delta_recover_movement; gjk_input.m_transformB = p_transformB; // Perform GJK test @@ -1320,6 +1322,8 @@ bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btC /// Contact test btTransform tA(p_transformA); + // Avoid repeat penetrations + tA.getOrigin() += r_delta_recover_movement; btCollisionObjectWrapper obA(nullptr, p_shapeA, p_objectA, tA, -1, p_shapeId_A); btCollisionObjectWrapper obB(nullptr, p_shapeB, p_objectB, p_transformB, -1, p_shapeId_B);