--code snippet
local recoilcf = cfnew()
local camrecoilcf = cfnew()
local to_recoilcf = cfnew()
local to_camrecoilcf = cfnew()
run.RenderStepped:Connect(function(dt)
recoilcf = recoilcf:Lerp(to_recoilcf, .4)
camrecoilcf = camrecoilcf:Lerp(to_camrecoilcf, .4)
camera.CFrame *= camrecoilcf
view_model.Root.CFrame *= recoilcf
to_recoilcf = to_recoilcf:Lerp(CFrame.new(), .1)
to_camrecoilcf = to_camrecoilcf:Lerp(CFrame.new(), .2)
end)
user.InputBegan:Connect(function(ss)
if ss.UserInputType == Enum.UserInputType.MouseButton1 then
to_recoilcf = to_recoilcf* CFrame.new(0,0, pushback) * CFrame.Angles(pitch, yaw, roll)
to_camrecoilcf = to_camrecoilcf*CFrame.new(0,0, pushback/3) * CFrame.Angles(pitch/4.5, yaw/3, roll/3)
end
end)
im aware that it lerps faster because of the higher framerate obviously, but even after attempting to multiply it with the deltatime, or deltatime*60, it just dont budge (it overshoots)
im not sure why, i have other lerp functions in the same loop which do just fine when multiplying them with deltatime*60, although those are custom lerp functions for numbers only: number + (target-number) * speed
Thanks for the reply. Yes, please elaborate. Iām not sure how I would implement your, what I assume is a rate limited bullet velocity, into my :Lerp() function.
I tested your code snippet and it does work albeit only for the viewmodel recoil, the camera still overshoots but honestly it shouldnt. probably an issue on my end ill have to look into that. thanks for the help