I found this post which suggests how the camera’s cframe can be changed to stretch or tilt the camera.
Taking the aspect ratio of the player’s current screen, how could I calculate the cframe if it was scaled down to 4:3 or any other aspect ratio? Is there a simple formula for this?
a good example for what i want is on the ffmpeg wiki:
original image (4:2)
scaled down to 320x240 (4:3)
!
it does stretch the screen, but the change can’t be the same for every screen because not every player uses the same monitor with the exact same dimensions.
You can probably get the screen aspect ratio and modify the stretch values based on that, I’m not sure what scaling you want because the formula varies based on it.
I think I have found something that works.
When I get the aspect ratio of something like 4:3 down to 1.333:1, I can do something like this CFrame.new(X, Y, Z, R00 /1.333, R01, R02, R10, R101 /1, R12, R20, R21, R22)
this should get me what I want. sorry for the troubles!
I realized that this method was still constant and did not adapt to the screens of players. I made a script that I think works for me. Here’s the script!
local rs = game:GetService("RunService")
local x, y = 16, 9 -- this is the aspect ratio that looks normal
local aspectratio = x/y
local cam = workspace.CurrentCamera
local vpsize
local cframe = CFrame.new(0,0,0,1,0,0,0,1,0,0,0,1)
rs.RenderStepped:Connect(function()
vpsize = cam.ViewportSize
local R00 = (vpsize.X / vpsize.Y) / x
local R11 = 1 / y
print(R00, R11)
cframe = CFrame.new(0,0,0,R00,0,0,0,R11,0,0,0,1)
cam.CFrame *= cframe
cam.FieldOfView = 70 / y
end)