In models it is Model:GetBoundingBox() or you can calculate the bounding box manually by using the positions of all the parts in the model.
I suppose there isn’t any function to get terrain’s bounding box but at least a way to get the terrain cells positions (in Vector3) which can be used to calculate the bounding box?
Or any other alternative to finding the bounding box (automatically or at least semi-automatic)?
What information are you given? If you’re given the size and position of a given terrain chunk it will be easy to find the “bounding box” to represent it.
Terrain doesn’t really have a bounding box. Note that when working with terrain you’re working with filled or empty voxel regions, so bounding boxes can be fairly arbitrary. I honestly have no clue how you’d go about doing that either - you could try using ReadVoxels to find empty terrain cells, if it returns empty terrain cells to begin with and potentially form boxes from that.
The overall possible terrain editable region can probably be fetched from MaxExtents (see Region3int16 for calculating size and center, orientation is implicitly 0), though that’s not really a bounding box so probably, in the same vein, not helpful.
You could do a 3D floodfill with ReadVoxels (checking against occupancy equaling 0). Once you have all of the voxels in a given area, find the minimums and maximums, then translate that to world space.
I don’t currently, but floodfill algorithms are pretty easy to make. I could try to take a stab at it after work today, but I don’t have time at the moment. For now, I would recommend googling Floodfill Algorithm and starting from there. Or maybe someone else on here would be willing to give it a try.