Lerping is extremely inconsistent and i don't know why [UNSOLVED]

I’m trying to make a lerping reload for guns that do not have reload animations (which right now is all, but that’s besides the point)

i told myself “oh this won’t be so difficult!”, but it’s difficult
the AK47 lerps fine, but the MK23 just… yeah you can see for yourself

PLEASE help me :sob:

local rightArm = viewmodel:FindFirstChild("Right Arm")
        local leftArm = viewmodel:FindFirstChild("Left Arm")
        local readyPose = viewmodel:FindFirstChild("ReadyPose")

        if not (rightArm and leftArm and readyPose) then
            warn("Missing parts for ReloadLerp")
            return
        end
        
        local rightPose = readyPose:FindFirstChild("RightArm")
        local leftPose = readyPose:FindFirstChild("LeftArm")

        local viewmodelOffset = CFrame.new(-1.5, -1, 0)

        local readyRightOffset = readyPose.RightArm.Value * viewmodelOffset
        local readyLeftOffset = readyPose.LeftArm.Value * viewmodelOffset

        if not (readyRightOffset and readyLeftOffset) then
            warn("Missing ready pose offsets for arms!")
            return
        end
        
        local rotation = CFrame.Angles(
            math.rad(45), -- Pitch down
            math.rad(45), -- Yaw left
            0
        )

        local reloadMovement = CFrame.new(0, 0, 0)
        local reloadRightOffset = (reloadMovement * rotation) * viewmodelOffset
        local reloadLeftOffset = (reloadMovement * rotation) * viewmodelOffset

        local originalRightOffset = camera.CFrame:ToObjectSpace(rightArm.CFrame)
        local originalLeftOffset = camera.CFrame:ToObjectSpace(leftArm.CFrame)

        local reloadDuration = 0.25
        local startTime = tick()

        rService:BindToRenderStep("ReloadLerpViewmodel", Enum.RenderPriority.Camera.Value, function()
            local rawAlpha = math.clamp((tick() - startTime) / reloadDuration, 0, 1)
            local alpha = math.sin((rawAlpha * math.pi) / 2)

            local rightLocal = originalRightOffset:Lerp(reloadRightOffset, alpha)
            local leftLocal = originalLeftOffset:Lerp(reloadLeftOffset, alpha)
            
            rightArm.CFrame = camera.CFrame * rightLocal
            leftArm.CFrame = camera.CFrame * leftLocal
        end)
1 Like

Hocus Pocus, Topicus Bumpus

remains unresolved

bumping cuz im curious as well

STILL unsolved

um I would try to replicate it if I had your gun models and viewmodels and see if I could fix it because I think it’s some weird like cframe setup of the models whatever but just from the code I can’t tell

i can give you both if you’re really up to fixing this

though if you fail just let me know right away because i’m considering just storing each weapon rotation value in a module script (which is the exact opposite of what i want to do)

sorry I didn’t reply um sure I can try

1 Like

the fix was resolved in dms and it was to instead rotate the viewmodel around the center of the camera in object space so that it offsets it properly

1 Like