|
| 1 | +diff --git a/thirdparty/jolt_physics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp b/thirdparty/jolt_physics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp |
| 2 | +index e8a8c21459..4fb6c58c18 100644 |
| 3 | +--- a/thirdparty/jolt_physics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp |
| 4 | ++++ b/thirdparty/jolt_physics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp |
| 5 | +@@ -92,11 +92,14 @@ void CastConvexVsTriangles::Cast(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, uint8 |
| 6 | + static_cast<const ConvexShape *>(mShapeCast.mShape)->GetSupportingFace(SubShapeID(), transform_1_to_2.Multiply3x3Transposed(-contact_normal), mShapeCast.mScale, mCenterOfMassTransform2 * transform_1_to_2, result.mShape1Face); |
| 7 | + |
| 8 | + // Get face of the triangle |
| 9 | +- triangle.GetSupportingFace(contact_normal, result.mShape2Face); |
| 10 | ++ result.mShape2Face.resize(3); |
| 11 | ++ result.mShape2Face[0] = mCenterOfMassTransform2 * v0; |
| 12 | ++ result.mShape2Face[1] = mCenterOfMassTransform2 * v1; |
| 13 | ++ result.mShape2Face[2] = mCenterOfMassTransform2 * v2; |
| 14 | + |
| 15 | +- // Convert to world space |
| 16 | +- for (Vec3 &p : result.mShape2Face) |
| 17 | +- p = mCenterOfMassTransform2 * p; |
| 18 | ++ // When inside out, we need to swap the triangle winding |
| 19 | ++ if (mScaleSign < 0.0f) |
| 20 | ++ std::swap(result.mShape2Face[1], result.mShape2Face[2]); |
| 21 | + } |
| 22 | + |
| 23 | + JPH_IF_TRACK_NARROWPHASE_STATS(TrackNarrowPhaseCollector track;) |
| 24 | +diff --git a/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp b/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp |
| 25 | +index e03659454d..05c21eebfa 100644 |
| 26 | +--- a/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp |
| 27 | ++++ b/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp |
| 28 | +@@ -145,6 +145,10 @@ void CollideConvexVsTriangles::Collide(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, |
| 29 | + result.mShape2Face[0] = mTransform1 * v0; |
| 30 | + result.mShape2Face[1] = mTransform1 * v1; |
| 31 | + result.mShape2Face[2] = mTransform1 * v2; |
| 32 | ++ |
| 33 | ++ // When inside out, we need to swap the triangle winding |
| 34 | ++ if (mScaleSign2 < 0.0f) |
| 35 | ++ std::swap(result.mShape2Face[1], result.mShape2Face[2]); |
| 36 | + } |
| 37 | + |
| 38 | + // Notify the collector |
| 39 | +diff --git a/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp b/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp |
| 40 | +index 18441ea73b..566efb38ae 100644 |
| 41 | +--- a/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp |
| 42 | ++++ b/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp |
| 43 | +@@ -111,6 +111,10 @@ void CollideSphereVsTriangles::Collide(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, |
| 44 | + result.mShape2Face[0] = mTransform2 * (mSphereCenterIn2 + v0); |
| 45 | + result.mShape2Face[1] = mTransform2 * (mSphereCenterIn2 + v1); |
| 46 | + result.mShape2Face[2] = mTransform2 * (mSphereCenterIn2 + v2); |
| 47 | ++ |
| 48 | ++ // When inside out, we need to swap the triangle winding |
| 49 | ++ if (mScaleSign2 < 0.0f) |
| 50 | ++ std::swap(result.mShape2Face[1], result.mShape2Face[2]); |
| 51 | + } |
| 52 | + |
| 53 | + // Notify the collector |
0 commit comments