Hello everyone,
I have a script which works like this: if the player presses “Z” the camera zooms in and the FOV decreases.
local camera = workspace.Camera
local player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Z then
player.CameraMode = Enum.CameraMode.Classic
camera.FieldOfView = 15
end
end)
UIS.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Z then
player.CameraMode = Enum.CameraMode.Classic
camera.FieldOfView = 35
end
end)
And I also have an isometric camera:
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local CAMERA_DEPTH = 64
local HEIGHT_OFFSET = 2
camera.FieldOfView = 35
local function updateCamera()
--local character = player.Character
if camera.CameraSubject then
local character = camera.CameraSubject.Parent
if character then
local root = character:FindFirstChild("HumanoidRootPart")
if root then
local rootPosition = root.Position + Vector3.new(0, HEIGHT_OFFSET, 0)
local cameraPosition = rootPosition + Vector3.new(CAMERA_DEPTH, CAMERA_DEPTH, CAMERA_DEPTH)
camera.CFrame = CFrame.lookAt(cameraPosition, rootPosition)
end
end
end
end
RunService:BindToRenderStep("IsometricCamera", Enum.RenderPriority.Camera.Value + 1, updateCamera)
And would like to have a zoom-in/zoom-out animation like the one in the first 10 seconds of this video when the player presses “Z”: (the part where it zooms in to talk with the NPC and then zooms out)
How would I be able to achieve something like this? How would I do that? Any scripts that I need?
Let me know!
Thanks in advance!