Skip to content

Commit

Permalink
Fix bounding boxes for rigged models
Browse files Browse the repository at this point in the history
  • Loading branch information
KillzXGaming committed Nov 5, 2024
1 parent 35216e4 commit 69a2d2d
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,19 @@ private BoundingBox CalculateBoundingBox(FMDL model)
min = CalculateBBMin(vertices);
max = CalculateBBMax(vertices);
}
else
{
//Find largest bounding box
foreach (var bounding in aabb)
{
min.X = Math.Min(bounding.Min.X, min.X);
min.Y = Math.Min(bounding.Min.Y, min.Y);
min.Z = Math.Min(bounding.Min.Z, min.Z);
max.X = Math.Min(bounding.Max.X, max.X);
max.Y = Math.Min(bounding.Max.Y, max.Y);
max.Z = Math.Min(bounding.Max.Z, max.Z);
}
}

var c = (min + max) / 2.0f;
var e = (max - min) / 2.0f;
Expand Down

0 comments on commit 69a2d2d

Please sign in to comment.