What youre going to need to do is use our wonderful deltatime! deltatime is basically the time since the last frame, and by multiplying it by whatever you’re doing it’ll end up running the exact same no matter the frame rate.
How do we get deltatime? well RenderStep gives it to us as an argument or parameter (I cant remember which one its called )
RS.RenderStepped:Connect(function(DeltaTime)
end)
heres an example, lets say we have this code here:
local TimePassed = 0
RS.RenderStepped:Connect(function(DeltaTime)
TimePassed += 1
end)
What this would do is add 1 to TimePassed every frame, which isnt exactly what I want if I want to count by seconds.
If I have like 60 fps, then by the end of a second the number will be 60 instead of just 1.
so what we can do is multiply the 1 second by delta time!
(In this case since the number is 1 you could just add DeltaTime, but this is an example)
Im not really going to go into the math of everything, but basically what this does is that after one second has passed, no matter my fps, the TimePassed will be around 1 second.
You may need to multiply the dt by a large constant.
Your other numbers like 35, -5, and 5 may also need to be changed as these numbers will be based per frame now.
If this doesn’t work, please send me the original code including your calculations for mouseDelta.
In order to properly compensate for framerate, you must define a desired speed (which is a function of distance over time), then multiply it by delta time ((distance / time) * time), which will give you the distance.
local elapsed = 0
-- your logic
local clampedValue = math.clamp((dividedMouseDelta * elapsed) * dt), -5, 5)
elapsed += dt -- increment elapsed at the end
You’re using AngularVelocity which applies an angular velocity onto the assembly it’s connected to.
The physics engine already compensates for lag and mouse delta changes according to framerate, so you shouldn’t be compensating for delta time in the first place.