I think it has to do with how you get the center of the new boxes. I think it has to do with these lines:
octNodes[0].origin = FVector(boundingBox.origin.X - center.X, boundingBox.origin.Y - center.Y, boundingBox.origin.Z + center.Z);
You take the origin of the very first box and substract the center of the new box (which is half of the previous iteration of the box, if I understand that correctly). This works fine for the first iteration. However for any following iteration it doesn’t, because:
lets say the bounding box is 2x2x2
1st iteration:
x: 0 - 1 = -1
y: 0 - 1 = -1
z: 0 + 1 = 1
2nd iteration:
x: 0 - 0.5 = -0.5
y: 0 - 0.5 = -0.5
z: 0 + 0.5 = 0.5
this would make the numbers incorrect in what you’re trying to achieve.
If I have it correctly in my head the numbers for the second iteration would need to be:
x: -1.5
y: -1.5
z: 1.5
I’m not sure though. the longer i think about it the less sense it makes (the stuff I’ve written), but ultimately I think the issue is somewhere around that area.