Shift Lock Smoother Turning Help

I’m having an issue where my shift lock works properly; however, there seems to be a problem when the player is constantly spinning in a circle. There’s some jittering, and I believe it has something to do with the shift lock lerping. It seems like the camera goes slightly over the angle it needs to reach, which sometimes causes it to move in a slightly different direction from how the camera is turning. The issue is very little, and I could just leave it since no one would likely notice, but I was wondering if there’s a way to make it smoother and get rid of these small twitches.

this little part is added into the roblox scripts in StarterCharacterScripts in BaseCamera

local SLOW_TURN_SHIFT_LOCK_SPEED = 0.1

function BaseCamera:GetCameraXZ(LookVector: Vector3): Vector3
    return Vector3.new(LookVector.X, 0, LookVector.Z).Unit
end

function BaseCamera:CustomSlowTurnShiftLock(dt : number)
    if not self.humanoidRootPart then
        self:GetHumanoidRootPart()
        return
    end

    local lookVector = self:GetCameraXZ(self.currentCamera.CFrame.LookVector)
    local currentCFrame = self.humanoidRootPart.CFrame
    local targetCFrame = CFrame.new(currentCFrame.Position, currentCFrame.Position + lookVector)

    local newCFrame = currentCFrame:Lerp(targetCFrame, SLOW_TURN_SHIFT_LOCK_SPEED )
    self.humanoidRootPart.CFrame = newCFrame
end 
1 Like

I figured out how to fix it basically it involved a few extra calculations like DT and times it by 60

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.