Path: blob/master/thirdparty/jolt_physics/patches/0001-backport-upstream-commit-ee3725250.patch
45998 views
diff --git a/thirdparty/jolt_physics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp b/thirdparty/jolt_physics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp1index e8a8c21459..4fb6c58c18 1006442--- a/thirdparty/jolt_physics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp3+++ b/thirdparty/jolt_physics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp4@@ -92,11 +92,14 @@ void CastConvexVsTriangles::Cast(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, uint85static_cast<const ConvexShape *>(mShapeCast.mShape)->GetSupportingFace(SubShapeID(), transform_1_to_2.Multiply3x3Transposed(-contact_normal), mShapeCast.mScale, mCenterOfMassTransform2 * transform_1_to_2, result.mShape1Face);67// Get face of the triangle8- triangle.GetSupportingFace(contact_normal, result.mShape2Face);9+ result.mShape2Face.resize(3);10+ result.mShape2Face[0] = mCenterOfMassTransform2 * v0;11+ result.mShape2Face[1] = mCenterOfMassTransform2 * v1;12+ result.mShape2Face[2] = mCenterOfMassTransform2 * v2;1314- // Convert to world space15- for (Vec3 &p : result.mShape2Face)16- p = mCenterOfMassTransform2 * p;17+ // When inside out, we need to swap the triangle winding18+ if (mScaleSign < 0.0f)19+ std::swap(result.mShape2Face[1], result.mShape2Face[2]);20}2122JPH_IF_TRACK_NARROWPHASE_STATS(TrackNarrowPhaseCollector track;)23diff --git a/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp b/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp24index e03659454d..05c21eebfa 10064425--- a/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp26+++ b/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp27@@ -145,6 +145,10 @@ void CollideConvexVsTriangles::Collide(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2,28result.mShape2Face[0] = mTransform1 * v0;29result.mShape2Face[1] = mTransform1 * v1;30result.mShape2Face[2] = mTransform1 * v2;31+32+ // When inside out, we need to swap the triangle winding33+ if (mScaleSign2 < 0.0f)34+ std::swap(result.mShape2Face[1], result.mShape2Face[2]);35}3637// Notify the collector38diff --git a/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp b/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp39index 18441ea73b..566efb38ae 10064440--- a/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp41+++ b/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp42@@ -111,6 +111,10 @@ void CollideSphereVsTriangles::Collide(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2,43result.mShape2Face[0] = mTransform2 * (mSphereCenterIn2 + v0);44result.mShape2Face[1] = mTransform2 * (mSphereCenterIn2 + v1);45result.mShape2Face[2] = mTransform2 * (mSphereCenterIn2 + v2);46+47+ // When inside out, we need to swap the triangle winding48+ if (mScaleSign2 < 0.0f)49+ std::swap(result.mShape2Face[1], result.mShape2Face[2]);50}5152// Notify the collector535455