Trouble With Custom Friction and FPS

Hello everyone, I’m working on a ball racing game where friction isnt reliant on Roblox physics and rather it’s own calculation. My current issue is when the FPS lowers, not enough friction is applied and when FPS is higher too much friction is applied. I want players to all have have the same opportunities and power despite framerate


Intended FPS

Here is my friction code:

  local ThisMarble = --Just a part
  local CurrentPush = 100
  local PushModification = 0
  local Friction = 0.035

  local Delta = 60 / (1/dt)
  ThisMarble.Velocity = ThisMarble.Velocity:Lerp((Input * (CurrentPush + PushModification)* 1 ^ Delta), Friction) * (,0,1) + (ThisMarble.Velocity *,1,0))) 

I’ve tried tons of different methods but all either send me to the floating point error zone or just have no effect at all. Any help is appreciated!

Edit: Added missing friction variable to code my bad :B

Using Heartbeat instead of RenderStepped in the first line should probably help the issue.

1 Like

This does negate the issue however control feels off, as if its running way slower than it should.

(Actually the delta doesnt even do anything
1^x is always 1)

In order to properly scale the thingy by time I would probably just do something like

local frictionPerSecond = 0.1 --idk something you want that seems right

    --unrelated stuff

    marble.Velocity = ThisMarble.Velocity:Lerp(blahblahblah, frictionPerSecond*dt)*blahblahblah
1 Like