local fov = 90.0
local enabled = false

re.on_draw_ui(function()
    local changed = false

    if imgui.tree_node("FOV Changer") then
        changed, enabled = imgui.checkbox("Enabled", enabled)
        changed, fov = imgui.slider_float("FOV", fov, 1.0, 180.0)

        imgui.tree_pop()
    end
end)

re.on_pre_application_entry("BeginRendering", function()
    local camera = sdk.get_primary_camera()
    if not camera then return end

    if enabled then
        camera:call("set_FOV", fov)
        fov = camera:call("get_FOV")
    end
end)