Got it, thanks! Did you say it was possible to see in the editor? How exactly? I made an animation that moves left/right and I don't see jitter with my monitor refresh rate (100Hz) and editor settings (100Hz).
If I change my monitor to 60Hz, set the editor frame rate to 60Hz, and have Simulate
checked but Deterministic
unchecked, then I do see jitter. It's easiest to see on the Hip
bone when moving from right to left. Set playback speed to 10% to see it more easily. The bone rotation lags behind due to physics, then when physics steps it applies Strength
and other settings that cause the bone to catch up to the unconstrained position, but the time elapsed between each time physics catches up is too long. When the happens you see the bone lagging behind, then a strong Strength
force is applied that makes the bone jump toward the unconstrained position, then you see it lag behind again, then it jumps again, etc. That is the "jitter".
If I set the Hip
physics constraint to 90Hz then the jitter mostly goes away in the editor. At 120Hz it is gone. The update rate needs to be high enough that the adjustments physics is making are not distracting. This depends on the rendering rate, the physics update rate, the skeleton movement, and the physics strength. When the rendering rate and physics update rate aren't divisible or the rendering rate fluctuates, it can cause a physics update to be missed by a frame. Often this is not important, but can cause a jump like this.
BTW, while looking into your issue we found that changing the physics constraint FPS can leave some accumulated time in the constraint. This can affect the update rate interactions, particularly how the skeleton behaves when changing from a higher FPS to lower. For example, say you see jitter with 60Hz, you change to 120 and it goes away, you change back to 60 and there appears to be no jitter now! To reset all the constraints you can click Reset
or Reset All
or change animate/setup mode and back. That zeros the accumulated time and now you can see the 60Hz jitter consistently. We'll fix this so changing the FPS resets the constraint automatically.
If you check Deterministic
you won't be able to see jitter, as it calculates the exact pose from frame 0. This is different from applying physics all the time.
What is your monitor refresh rate and editor frame rate settings?
At runtime, what is the rendering frame rate?
It's worth checking to make sure you are not updating physics twice each frame (and that you are indeed updating exactly one time). Skeleton updateWorldTransform
should only be called with Physics.update
once per application frame render.
I know you reported 120Hz physics constraints don't fix the problem at runtime. I'm not sure why that is, there could be something else happening. Indeed the expected jitter that I see with the Hip
bone is not quite the same as what you showed. You could try 250 FPS (type the value or drag the slider extra far).
I exported and played the left/right animation using Skeleton Viewer with 60Hz monitor and physics and didn't see jitter. Skeleton Viewer uses vsync so it renders at the monitor refresh rate.
The next step would be for you to provide a runtime example that shows the problem in the simplest possible way (we don't want to dig through your application code 🙂).