I want to smoothly reset the camera back to the players head with no stutters, right now I kind of achieved that with setting the cameras CFrame to the players head CFrame but there is just one slight throw off
local cameraMoveTween = ts:Create(cam, TweenInfo.new(3.5), {CFrame = char:FindFirstChild("Head").CFrame})
-- Wait for the tween to finish before switching to first-person
cameraMoveTween.Completed:Wait()
-- Set to first-person mode
cam.CameraSubject = plr.Character:FindFirstChild("Humanoid")
cam.CameraType = Enum.CameraType.Custom
plr.CameraMode = Enum.CameraMode.LockFirstPerson
It’s not that big of an issue the camera just flips up and then goes down to the players head, but I would still like for it to be fixed if possible…
Any and all help is appreciated! I love to learn
Have you tried settings the cameras CFrame to the heads CFrame,
I think this should prevent the zooming-in effect you see in the video.
it should look something like this
local cameraMoveTween = ts:Create(cam, TweenInfo.new(3.5), {CFrame = char:FindFirstChild("Head").CFrame})
-- Wait for the tween to finish before switching to first-person
cameraMoveTween.Completed:Wait()
-- Set to first-person mode
cam.CFrame = char:FindFirstChild("Head").CFrame -- The part I added
cam.CameraSubject = plr.Character:FindFirstChild("Humanoid")
cam.CameraType = Enum.CameraType.Custom
plr.CameraMode = Enum.CameraMode.LockFirstPerson
Unless you need the camera to go smoothly for a specific reason I actually think it looks really good it may seem like a bug but it actually looks and feels good to the transition personally i would just keep it it looks good imop
You should try keeping the CameraMode locked in First person if it isn’t already and then you jusyt tween it normally while the camera mode is on Scriptable and change it back to Custom when you need it to lock back
I tried it and realized that you can’t cancel the camera twinning by changing the camera mode. So I came to a less elegant solution.
--!strict
-- module script, add it into ur localscript
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer :: Player
local character = player.Character or player.CharacterAdded:Wait()
local head = character:WaitForChild("Head") :: BasePart
local humanoid = character:FindFirstChild("Humanoid") :: Humanoid
local camera = workspace.CurrentCamera :: Camera
local SMOOTHING_FACTOR = 0.1
local COMPLETION_TRESHOLD = 0.001
local DELAY_BEFORE_LOCK = 0.05
local function cameraMoveLerp (): ()
local desiredCFrame = head.CFrame
while task.wait() do
camera.CFrame = camera.CFrame:Lerp(desiredCFrame, SMOOTHING_FACTOR)
local distance = (camera.CFrame.Position - desiredCFrame.Position).Magnitude
if distance < COMPLETION_TRESHOLD then
camera.CFrame = head.CFrame
camera.CameraType = Enum.CameraType.Custom
player.CameraMaxZoomDistance = 0
break
end
end
end
return cameraMoveLerp
--ur local script
local LerpFirstPerson = require(script.LerpFirstPerson)
task.wait(5) -- for tests
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
LerpFirstPerson()