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:
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:
0.1 * (dt * 60)
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)
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.
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.