Hello devs! So I am working on my Third Person Camera, and this is the code :
rs.RenderStepped:Connect(function()
if char then
local rootPart = char:FindFirstChild("HumanoidRootPart")
local head = char:FindFirstChild("Head")
if rootPart then
local startCF = CFrame.new((rootPart.CFrame.Position + Vector3.new(0,2,0))) * CFrame.Angles(0,math.rad(xAngle),0) * CFrame.Angles(math.rad(yAngle),0,0)
local cameraCFrame = startCF + startCF:VectorToWorldSpace(Vector3.new(cameraPos.X,cameraPos.Y,cameraPos.Z))
local cameraFocus = startCF + startCF:VectorToWorldSpace(Vector3.new(cameraPos.X,cameraPos.Y,-50000))
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame:Lerp(CFrame.lookAt(cameraCFrame.Position,cameraFocus.Position),0.3)
uis.MouseBehavior = Enum.MouseBehavior.LockCenter
end
end
end)
And this happens :
But as long as I remove :Lerp()
rs.RenderStepped:Connect(function()
if char then
local rootPart = char:FindFirstChild("HumanoidRootPart")
local head = char:FindFirstChild("Head")
if rootPart then
local startCF = CFrame.new((rootPart.CFrame.Position + Vector3.new(0,2,0))) * CFrame.Angles(0,math.rad(xAngle),0) * CFrame.Angles(math.rad(yAngle),0,0)
local cameraCFrame = startCF + startCF:VectorToWorldSpace(Vector3.new(cameraPos.X,cameraPos.Y,cameraPos.Z))
local cameraFocus = startCF + startCF:VectorToWorldSpace(Vector3.new(cameraPos.X,cameraPos.Y,-50000))
workspace.CurrentCamera.CFrame = CFrame.lookAt(cameraCFrame.Position,cameraFocus.Position)
uis.MouseBehavior = Enum.MouseBehavior.LockCenter
end
end
end)
It works as indeeded :
So what’s the problem? Why does this happen?