How to Make AddForce() Frame rate independent?

How to Make AddForce() Frame rate independent? I Used GetWorld()->DeltaTimeSeconds To make this frame rate independent but i get different Results at 7fps, 60fps and 144 fps.

1 Like

AddForce is already fps independent. A force has to be applied continuously (ie. call AddForce every Tick), and physics engine will calculate acceleration and integrate velocity/position every frame based on frame time. If you multiply the force by DeltaTime you are making it inverse-proportional to framerate (higher FPS = smaller force).

AddImpulse is punctual, it’s an instant velocity change.
If you add a fixed impulse every Tick, it will be framerate-dependent (higher FPS = more impulses = more speed). In this case you’d have to multiply by DeltaTime, but then it becomes essentially equivalent to AddForce.

So in short, if you want a continuous force use AddForce (no deltatime) in Tick, and if you want an instant impulse use AddImpulse (no deltatime).

2 Likes

I Use the following code, and using the command “t.MaxFps”, I change the frame rate, and as you said I didn’t use delta time in add force code but I get 3 very different results in 7, 60 and 144 fps. what am I doing wrong?
Capture

The Answer Is In This Article, I Read And implemented, It Worked Perfectly For Me.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.