I am making a very simple game in SpriteKit where a sprite is going in a straight line from left to right.
I use applyForce() to give it a constant push. I noticed though, that there are random stutters in the movement every few seconds.
At first I thought these were fps issues but the fps are stable (again, simple game, 2 draw passes in the example). The time delta between updates is exactly the same every time.
After investigating, I could locate the reason to the underlying physics simulation by SpriteKit. When applying a constant speed (e.g. each frame setting velocity.dx = 6) the updates are mostly correct, but sometime the engine just seems to "jump ahead" even though the fps stay stable. Interestingly, it is exactly 1.5 simulation steps in one update loop every so often.
So for example, the position of the sprite would look like this:
x = 0
x = 3
x = 6
x = 9
x = 13.5
x = 16.5
x = 19.5
This leads to an obvious stutter that is not caused by fps drops. Does anyone know what causes this or how to fix this. Unfortunately you do not have direct access to the physics engine of SpriteKit.