I created this simulation for a ball, and it is running at a fixedTimeStep but the issue seems to be that the lower the FPS is the slowed the simulation runs and the opposite is true on a higher FPS, i tested with 60 FPS vs 240 fps
this is on the client btw
PredictConnection = RunService.Heartbeat:Connect(function(DT)
local currentTime = workspace:GetServerTimeNow()
accumulator += DT
if clientControl and accumulator >= BallSimulation.fixedTimeStep then
predictedVelocity = BallSimulation.updateVelocity(predictedVelocity, BallSimulation.fixedTimeStep)
predictedVelocity = BallSimulation.limitSpeed(predictedVelocity)
predictedPos = predictedPos + predictedVelocity * BallSimulation.fixedTimeStep
predictedPos, predictedVelocity = BallSimulation.handleGroundCollision(predictedPos, predictedVelocity, GroundY, ball)
accumulator = 0
end
if clientControl and currentTime < clientControlendTime then
-- The client is in control
ball.Position = ball.Position:Lerp(predictedPos, .1)
return
elseif clientControl then
clientControl = false
blendBackStartTime = currentTime
end
local latency = currentTime - lastUpdateTime
if currentTime < blendBackStartTime + blendBackDuration then
local blendAlpha = (currentTime - blendBackStartTime) / blendBackDuration
predictedPos = predictedPos:Lerp(serverPos, blendAlpha)
predictedVelocity = predictedVelocity:Lerp(serverVelocity, blendAlpha)
elseif latency < interpolationTime then
local alpha = latency / interpolationTime
predictedPos = predictedPos:Lerp(serverPos, alpha)
predictedVelocity = predictedVelocity:Lerp(serverVelocity, alpha)
else
predictedPos = serverPos
predictedVelocity = serverVelocity
end
ball.Position = predictedPos
end)
end