Jitter still present when FPS is lower than physicsFPS #13
Description
The problem
I created a simple little game but on some weak gpus (mobile) it does not run very well. This created a jitter. I tried to apply this addon to fix the issue but it did not work. After looking at the code a bit I think I found the problem. All in 2D, fps limited to 58, physics_fps is set to 60.
What I think is wrong
In the code the last frames that are used for the interpolation are updated in the process function via the RefreshTransform() function. This works perfectly if the game runs at a high fps with relatively slow physics. However this is problematic in case the visual process can run twice between two physics frames. In this case the previous and current positions are updated twice, effectively to the same value. This makes the object jump to the next frame, same as if no interpolation was applied.
My fix
For me, changing the code in a way that the positions are always updated in the pyhsics_process fixed the issue.
Is there a reason the updates are implemented inside the process function with flags signaling wether to use it or not? To me it looks like the flags only try to mimic the case where the physics_process function updates the positions.
Otherwise I really like this addon, it helped me a ton. Hope I could help.