Lerp going insanely fast on high fps

Hello, I am having issues with CFrame:Lerp() and my custom lerp module. In my game, which uses ball physics, I implement lerping, but when a player’s fps is high, it goes wayyy too fast. Here is a snippet of my lerp usage:

		local c1 = char.HumanoidRootPart.CFrame
			local c2 = char.HumanoidRootPart.CFrame+char.HumanoidRootPart.CFrame.LookVector * yoff * 4 - Vector3.new(0,char.Torso.Position.Y - (workspace.Court.Position.Y + 2),0) 
			task.spawn(function()
		for i = 0, 1 , 0.05 do
				if ball.Parent:GetAttribute("CanUpdateLerp")== false and ball.Parent:GetAttribute("LastHit") ~= char.Name then return end
	
				
				ball.CFrame = CFrame.lookAlong(c1:Lerp(c2, i).p, char.HumanoidRootPart.CFrame.LookVector)
			task.wait()
		end
		end)

I have tried doing task.wait(0.03) but it makes the ball look super weird and glitch around. Help appreciated, thank you!

1 Like

multiply i by delta time * 60 (or whatever the fps is at which the lerp is going at your desired speed)

dt = runservice.RenderStepped:Wait()
...Lerp(..., i * dt * 60)
1 Like

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