Skip to content

Commit

Permalink
fix(collisions): fix false hit point on manifold caused by vector ini…
Browse files Browse the repository at this point in the history
…tialization
  • Loading branch information
fallenatlas committed Aug 21, 2024
1 parent 2a91a5e commit 0adf196
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion engine/src/collisions/narrow_phase/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ContactPointData> points = std::vector<ContactPointData>(polygon2.size());
std::vector<ContactPointData> points;

for (const glm::vec3& point : polygon2)
{
Expand All @@ -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,
Expand Down

0 comments on commit 0adf196

Please sign in to comment.