From f394db4b36207abf1ad04a5cd8bf12a2235af2e5 Mon Sep 17 00:00:00 2001 From: vitawrap Date: Sun, 28 Dec 2025 17:46:46 +0100 Subject: [PATCH] ConvexFeature: Fix collision list object references Turns out ConvexFeature::collide assumes the second round of testVertex calls will only add one entry to the collision list at a time and was erroneously only changing the last object and material reference. --- Engine/source/collision/convex.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Engine/source/collision/convex.cpp b/Engine/source/collision/convex.cpp index f4f441bb8..1051ed99d 100644 --- a/Engine/source/collision/convex.cpp +++ b/Engine/source/collision/convex.cpp @@ -111,13 +111,14 @@ bool ConvexFeature::collide(ConvexFeature& cf,CollisionList* cList, F32 tol) U32 storeCount = cList->getCount(); testVertex(*vert,cList,true, tol); - // Fix up last reference. material and object are copied from this rather + // Fix up added references. material and object are copied from this rather // than the object we're colliding against. - if (storeCount != cList->getCount()) + while (storeCount < cList->getCount()) { - Collision &col = (*cList)[cList->getCount() - 1]; + Collision &col = (*cList)[storeCount]; col.material = cf.material; col.object = cf.mObject; + ++storeCount; } vert++; }