Earlier today I discovered a neat trick on complete accident that allows you to modify the horizontal and vertical field of view and I wanted to share it since it could have some cool use cases and it’s also pretty hilarious. It’s very buggy, may be prone to crashes and can break at any time, so I’d recommend to only use it for quick transitions and stuff or to just mess around.
Usage
The code sample below is a module script that I quickly made to test it out. squash
should be a number similar to ParticleEmitter.Squash
(values below 1 stretch horizontally, above stretches vertically and below 0 breaks the fabric of reality). camera
is an optional parameter that allows you to specify which camera to modify.
Note that for this function to work in its current state it should be called on each frame after all camera manipulation stuff is completed unless CameraType
is set to Scriptable
, much like other camera functions.
--!strict
return function(squash:number, camera:Camera?)
local currentCamera = camera or workspace.CurrentCamera or error('attempt to adjust fov scale with no currentcamera set')
local cf = currentCamera.CFrame
if squash > 1 then
currentCamera.CFrame = CFrame.fromMatrix(cf.Position, cf.XVector / squash, cf.YVector, cf.ZVector)
elseif squash < 1 then
currentCamera.CFrame = CFrame.fromMatrix(cf.Position, cf.XVector, cf.YVector * squash, cf.ZVector)
end
end
Again I want to reiterate that this could break due to updates, because at the end of the day it is a bug and much like negative reflectance it may just stop working at some point.
Module file:
FOVDecoupler.lua (476 Bytes)