So I’m trying to make a custom camera system that acts like Roblox’s default camera system but I’m trying to tween the camera. The tweening itself works fine but there’s a small problem. When the camera tweens, the character’s animations will become jittery and the only solution that worked for me is to just remove the tween. I’m pretty certain it’s possible to tween the camera without jittery animations because I’ve seen games do it before.
Here is what the animations are supposed to look like (with no camera tween):
https://streamable.com/tn87hq
Here are the animations with a camera tween speed of .075:
https://streamable.com/k2ukq1
And here are the animations with a camera tween speed of .1:
https://streamable.com/juy8mw
The jittering is noticeable at all tween speeds I’ve tested.
Here is the code I have for updating/tweening the camera
runService.RenderStepped:Connect(function()
if camera.CameraType ~= Enum.CameraType.Scriptable then
camera.CameraType = Enum.CameraType.Scriptable
end
local startCF = CFrame.new(root.CFrame.Position + Vector3.new(0, (root.Size.Y + head.Size.Y) / 2, 0)) * CFrame.Angles(0, math.rad(xAngle), 0) * CFrame.Angles(math.rad(yAngle), 0, 0)
local cameraCF = startCF:ToWorldSpace(CFrame.new(cameraOffset.Value.X, cameraOffset.Value.Y, cameraOffset.Value.Z))
local cameraFocus = startCF:ToWorldSpace(CFrame.new(cameraOffset.Value.X, cameraOffset.Value.Y, -10000))
local camRay = Ray.new(head.CFrame.p, (cameraCF.Position - head.CFrame.Position).Unit * ((head.CFrame.Position - cameraCF.Position).magnitude + .4))
local part,pos = workspace:FindPartOnRay(camRay, character, false, true)
if part then
local obstructionDisplacement = (pos - root.Position)
local obstructionPosition = root.Position + (obstructionDisplacement.Unit * (obstructionDisplacement.Magnitude - 0.5))
cameraCF = CFrame.new(obstructionPosition)
end
tweenService:Create(camera, TweenInfo.new(.075, Enum.EasingStyle.Linear), {CFrame = CFrame.new(cameraCF.Position, cameraFocus.Position)}):Play()
end)
Any help would be appreciated, thank you.