i have no idea why this is smoothly lerping, the getrollangle always returns 1, 0 or -1 and the lerping alpha is always the same number. can’t figure it out, please help!!
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Camera = workspace.CurrentCamera
local rad = math.rad
local Rot = CFrame.new()
local function GetRollAngle()
local Character = Player.Character
if not Character then
return
end
local Cf = Camera.CFrame
return -Cf.RightVector:Dot(Character.Humanoid.MoveDirection)
end
RunService:BindToRenderStep("RotateCameraInDirectionPlayerIsGoing", Enum.RenderPriority.Camera.Value + 1, function()
local Roll = GetRollAngle() * 2
Rot = Rot:Lerp(CFrame.Angles(0, 0, rad(Roll)),0.075)
Camera.CFrame *= Rot
end)