Hey fellow developers!
I am trying to figure out how to make a simple professional manual camera zoom in Roblox that is used with keyboard control (ex. m - zoom in | n - zoom out).
I am not taking about the default camera zoom, rather ones you see in a President’s Oval Office address, or anything really.
This video shows what I mean (Notice how the camera zooms in slowly to Mr. Obama).
I believe all this takes is a simple FOV change, but I do not know how to script that out or even forward it into a working state.
Anything helps, thank you!
4 Likes
Here is a little function I just made:
local tweenService = game:GetService('TweenService')
function zoom(speed, factor)
local tweenInfo = TweenInfo.new(
speed,
Enum.EasingStyle.Linear,
Enum.EasingDirection.In,
0,
false,
0
)
local tween = tweenService:Create(workspace.CurrentCamera, tweenInfo, {FieldOfView = factor}):Play()
end
To call it you just do:
zoom(5, 30) -- 5 is the speed and 30 is the FOV value
Hope this helped!
EDIT: do this to try it and make sure its a local script in StarterGui:
local tweenService = game:GetService('TweenService')
function zoom(speed, factor)
local tweenInfo = TweenInfo.new(
speed,
Enum.EasingStyle.Linear,
Enum.EasingDirection.In,
0,
false,
0
)
local tween = tweenService:Create(workspace.CurrentCamera, tweenInfo, {FieldOfView = factor}):Play()
end
wait(10)
zoom(5, 30)
4 Likes