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.
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).
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?
The Answer Is In This Article, I Read And implemented, It Worked Perfectly For Me.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.