I made a script that smooths out the camera of the player, however when the player moves they jitter a bit. I have tried multiple ways to fix this (with lerping or tweening the camera cframe) but nothing seemed to have helped. Does anyone know how to fix this?
My script:
local plr = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
local head:Part = plr.Character:WaitForChild("Head")
local pos = Instance.new("Vector3Value")
game:GetService("RunService").RenderStepped:Connect(function()
game:GetService("TweenService"):Create(pos,TweenInfo.new(.1,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{Value = head.Position}):Play()
local dif = head.Position-pos.Value
cam.CFrame-=dif
end)
I had a similar issue in my game. I fixed it using :BindToRenderStep with a priority of Enum.RenderPriority.Camera.Value. Try and see if it helps. (you can also experiment with the priority. Here is a link.)
Hmm. It seems like the character is jittering, not the camera. Is there a script controlling the characters movement based on the camera CFrame? Im not sure what is causing the issue here. Maybe something with the tweening? You could try doing some smoothing (or offsetting) with deltaTime. That would require some math tho.
I’m giving up on this, there is no script controlling the player and it jitters even in a brand new place. I’ve tried everything but nothing worked. Thank you for your help tho!