Update collide_item.cpp

Updated non-collidable volumes check.
This commit is contained in:
Adngel 2024-10-28 15:05:50 +01:00
parent 0a8eb65de3
commit 0faa11a882

View file

@ -234,6 +234,13 @@ CollidedObjectData GetCollidedObjects(ItemInfo& collidingItem, bool onlyVisible,
if (!Geometry::CircleIntersects(circle, collidingCircle))
continue;
// Skip if either bounding box has any zero extent (not a collidable volume).
if (bounds.GetExtents().Length() > 0)
continue;
if (collidingBounds.GetExtents().Length() > 0)
continue;
auto box0 = bounds.ToBoundingOrientedBox(staticObj.pos.Position);
auto box1 = collidingBounds.ToBoundingOrientedBox(collidingItem.Pose);
@ -241,13 +248,6 @@ CollidedObjectData GetCollidedObjects(ItemInfo& collidingItem, bool onlyVisible,
if (customRadius > 0.0f)
box1.Extents = Vector3(customRadius);
// Skip if either bounding box has any zero extent (not a collidable volume).
if (box0.Extents.x > 0 || box0.Extents.y > 0 || box0.Extents.z > 0)
continue;
if (box1.Extents.x > 0 || box1.Extents.y > 0 || box1.Extents.z > 0)
continue;
// Test accurate box intersection.
if (box0.Intersects(box1))
collObjects.Statics.push_back(&staticObj);