Right, first off, the need: I need to know the dimensions of map trees. How wide, how deep, how high.
OK, so I got a script that can return trees within a radius anywhere on the map, and for each tree I got this bit of code:
_thisTree = _this select 0;
_TreeBoundingBox = boundingBox _thisTree;
_XTree = (_TreeBoundingBox select 1 select 0) - (_TreeBoundingBox select 0 select 0);
_YTree = (_TreeBoundingBox select 1 select 1) - (_TreeBoundingBox select 0 select 1);
_ZTree = (_TreeBoundingBox select 1 select 2) - (_TreeBoundingBox select 0 select 2);
_TreeVolume = _XTree * _YTree * _ZTree;
hint format ["TreeVolume = %1, width = %2, depth = %3, height = %4", _TreeVolume,_XTree,_YTree,_ZTree];
But it seems to return numbers that don't make sense. I'm getting what looks like bounding box information which, according to the docs is returned in the format:
[[minX, minY, minZ], [maxX, maxY, maxZ]]
and it looks like I should get the box dimensions by subtracting the mins from the maxs right?
But in practice I get exactly two sets of dimensions, for all trees. They look like this:
"Smaller" tree:
TreeVolume = 198.938, width = 5.14338, depth = 5.08731, height = 7.60292
Which doesn't seem to be outwith the bounds of possibility, and then there's the "larger" tree:
TreeVolume = 3864.52, width = 13.6102, depth = 12.011, height = 23.6402
Which as you can see looks too large. But this is aside from the fact that I only get these two dimensions.
Anyone have any idea what's going on?
*edit*
Seems like the trees are returning their model's bounding box dimensions without taking into account any scaling that's been done in the map-making process?