First of all, I hope I’m not posting this in the wrong sub (I couldn’t find a more suitable one).

I would like to ask you guys for help. It’s not a very difficult thing actually, but I figured it could be fun to ask it here.

I’m trying to figure out the correct height to spawn a camera actor that’s going to work as a minimap. The problem is that the levels are procedurally generated. We have a containing box 10000x10000, and a map could be, for example, 4000x7000, or 3000x3000, 5000x2000, and so on, arranged anywhere inside said containing box. As you can imagine the camera’s height has to change based on the size of the spawned map.

At the moment I’m able to calculate the median point of the map (using its length, widht, and world positioning), but I can’t figure out the correct height to keep the map precisely inside the camera scope.

I’m pretty sure there’s a geometric formula for pyramids, that would solve my problem, but I wasn’t able to figure it out yet.

So I wanted to share my problem, if anyone is willing to think about this with me.