How do I calculate the height of the camera to see all 4 corners?

What I mean is that I want to see all these 4 corners no matter my screen size

It looks like it’s working, but when I switch to another device, I can’t see all the 4 corners

Is there a way to calculate the height offset so that I can see all of the 4 corners?

local RunService = game:GetService('RunService')
local Camera = workspace.CurrentCamera
local HeightOffset = Camera.ViewportSize.Y / 50

RunService.RenderStepped:Connect(function()
	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CFrame = CFrame.lookAt(Vector3.new(0,HeightOffset,0),workspace.WorldPivot.Position)
end)

I’m afraid it’s not possible, as different devices have different length to breadth ratios.

1 Like

Maybe I can just keep moving the camera up until all 4 corners are visible.