Fixing RunService Lerp Jitter

Ever used RunService for part movement and ended up with jittering?

If so, I’ll show you how to fix it.

First, go to the workspace and set the PhysicsSteppingMethod to “Fixed” like this:

image

Once that’s done, you’re almost there. Just a few more things to know:

The only events that I’ve found that have zero jitter when using this method are PreAnimation and PreSimulation events. Any other event might give you slight jitter, though I’m not totally sure.

IMPORTANT
Make sure you’re using a delta time equation as your lerp alpha or else it’ll jitter.
Here are 2 simple ones I’ve used that had no jitter:

  1. 0.1 * (dt * 60)
  2. 1 - math.pow(0.001, dt)

Example script:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()

local Rs = game:GetService("RunService")

local Test = Instance.new("Part")
Test.Anchored = true
Test.Name = "Tp"
Test.Size = Vector3.new(2, 2, 2)
Test.Position = Vector3.zero
Test.Parent = workspace

local Hrp = Character:WaitForChild("HumanoidRootPart")

local function Follow(dt)
	local TargetPos = (Hrp.CFrame * CFrame.new(0, 0, -5)).Position
	local current = Test.Position
	current = current:Lerp(TargetPos, 1 - math.pow(0.001, dt)) --[[OR current:Lerp(TargetPos, 0.1 * (dt * 60))]]
	Test.Position = current
end

Rs.PreSimulation:Connect(Follow)

and that should be it !!

4 Likes

This is supposed to be in #resources:community-tutorials!

2 Likes

Oh lol I couldn’t find that, thank you for the help!!!

1 Like

Your welcome! A lot of people make that mistake.

2 Likes

Uh oh. This is probably an Engine bug then, and Fixed is eventually going to be removed as well so you shouldn’t rely on this

1 Like

it’s the only method I’ve found that has worked. atm Also, where did you hear it’s being removed?

That is the procedure for 3-phase rollouts like this. Phase 1 is opt-in, with Default being Fixed (old behaviour), Phase 2 is opt-out, with Default being Adaptive (new behaviour), and Phase 3 is fully-released, with everyone using the new behaviour and the option being removed.

Fixed timestepping will not be removed.

2 Likes

Even if it is never removed, it is still an unnecessary performance cost to enable, just to fix this one bug

I get the performance hit, but the RunService lerp jitter seriously messes with smooth movement. In some games, the small cost is worth it for a better player experience.

Have you considered reporting this as a bug to get the best of both worlds

Nah, I haven’t but I’m sure others have. It’s been a known problem for a minute now.