This seems to do the trick:
Code:
function getWorldBounds(out Vector min, out Vector max) {
local Actor a;
local box aBox;
local Terrain ter;
max = vect(0,0,0);
min = vect(0,0,0);
foreach AllActors(class'Actor', a) {
if (a.isA('Terrain')) {
ter = Terrain(a);
min.x = fmin(min.x, ter.Location.x);
min.y = fmin(min.y, ter.Location.y);
max.x = fmax(max.x, ter.Location.x + ter.NumPatchesX*ter.drawScale3d.x);
max.y = fmax(max.y, ter.Location.y + ter.NumPatchesY*ter.drawScale3d.y);
}
else if (a.CollisionType != COLLIDE_NoCollision) {
a.GetComponentsBoundingBox(aBox);
max.x = fmax(max.x, aBox.max.x);
max.y = fmax(max.y, aBox.max.y);
max.z = fmax(max.z, aBox.max.z);
min.x = fmin(min.x, aBox.min.x);
min.y = fmin(min.y, aBox.min.y);
min.z = fmin(min.z, aBox.min.z);
}
}
}
It appears terrain has no bounding box, I suspect it uses a different way of rendering that doesn't use bounding boxes. Min and max in the z direction are missing, this is a little annoying for my purpose but not a deal breaker.
Bookmarks