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)
!
If anyone responds, thank you in advance!
2 Likes
The post linked appears to have an explanation for how to accomplish what it displays.
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.
Have you tested this? Or are you assuming it doesn’t work?
i have tested it. I am not saying it doesn’t work. please reread.
sorry, it appears i have misread. The change is the same on each screen, which is not what i want. apologies for rudeness.
Why do you need it to be different on different screens? Just wondering.
I find the stretch funny and I want to see if it can be taken further. might be useful in very specific cases, but I am not certain.
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.
this is what i want to aim for, I just want to see if anyone on the site can provide a formula I can use to implement.
You can probably just do simple scaling like making the width scale the height of the screen to the power of 2.
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!
1 Like
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)