From 0adf196a000c05c3cb12bd63e5fd4d03e13e38b2 Mon Sep 17 00:00:00 2001 From: fallenatlas Date: Wed, 21 Aug 2024 23:18:23 +0100 Subject: [PATCH] fix(collisions): fix false hit point on manifold caused by vector initialization --- engine/src/collisions/narrow_phase/plugin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engine/src/collisions/narrow_phase/plugin.cpp b/engine/src/collisions/narrow_phase/plugin.cpp index 5f4047231..ad88e3517 100644 --- a/engine/src/collisions/narrow_phase/plugin.cpp +++ b/engine/src/collisions/narrow_phase/plugin.cpp @@ -135,7 +135,7 @@ void cubos::engine::narrowPhaseCollisionsPlugin(Cubos& cubos) polygon2 = cubos::core::geom::sutherlandHodgmanClipping(polygon2, 1, &refPlane, true); // Use the remaining contact point on the manifold - std::vector points = std::vector(polygon2.size()); + std::vector points; for (const glm::vec3& point : polygon2) { @@ -160,6 +160,7 @@ void cubos::engine::narrowPhaseCollisionsPlugin(Cubos& cubos) // Just make a final sanity check that the contact point // is actual a point of contact not just a clipping bug // and consider only points with positive penetration + CUBOS_DEBUG("Penetration: {}", contactPenetration); if (contactPenetration >= 0.0F) { ContactPointData contact = ContactPointData{.entity = ent1,