I want to lower the default camera angle after the player leaves a cutscene I created. After the cutscene, the player returns to full free camera control (default Roblox camera control settings), but I want it to be angled down more by default.
This is the angle after the cutscene ends and free camera control is given to the player
You can lerp the Camera’s CFrame’s Angles to do this. Here’s some code from my game where I automatically change the Angle to a higher position for ease of platforming. The values can be changed to make it a lower camera angle:
local RunService = game:GetService("RunService")
local checkDebounce = false
local lastCameraCFrame
local pitchAngleNumber_degree = -20
local count = 0
local camera = game.Workspace.CurrentCamera
local run = nil
local countUpForAlpha = 0.02
local function moveCameraFunc()
local countForMovingCamera = 0
-- the below is used to make the camera move smoothly in combination with a lower alpha
run = RunService.PostSimulation:Connect(function(deltaTime)
-- this below is here to stop the camera changing when the player moves their camera. For your use-case this likely isn't needed.
if CameraInput_RobloxScript.getRotationActivated() == true or countForMovingCamera >= 1 or isTheGamePaused == true then
run:Disconnect()
run = nil
end
-- this is the main thing here. I still should test this myself, but the system seems to be working for moving the camera's angle only in one direction, or to an extent, which I what I personally wanted.
local x,y,z = game.Workspace.CurrentCamera.CFrame:ToEulerAnglesXYZ()
local goal = CFrame.Angles(math.rad(pitchAngleNumber_degree),0,0)
camera.CFrame = camera.CFrame:Lerp(goal,countUpForAlpha*2)
countForMovingCamera = countForMovingCamera + countUpForAlpha/2.5
task.wait(deltaTime)
end)
--print("done?!")
end
Edit: You can make the Alpha on the Lerp be 1 if you want the camera to instantly change to the value you want. For a cutscene, that might work fine, but changing a camera mid-game while the player is moving requires something more smooth.