bevy_rapier icon indicating copy to clipboard operation
bevy_rapier copied to clipboard

Fix interpolation

Open Jakkestt opened this issue 9 months ago • 2 comments

This commit fixes the issue where if the games refresh rate is longer than the fixed timestep configured in the engine, when there is more than 1 fixed update within an update, the interpolation struct would hold the same position twice, making interpolation useless. The way you fix this issue is that you put the systems that are in charge of updating the interpolation struct in the FixedUpdate schedule and you constantly keep the struct updated on the 2 latest positions. You then have to put the system that is in charge of interpolation in the PostUpdate schedule, because we want interpolated position within the current fixed update and the next fixed update.

Jakkestt avatar Feb 28 '25 01:02 Jakkestt

Thanks! Do you have opinions about relying on other crates for interpolation ? Such as https://github.com/Jondolf/bevy_transform_interpolation.

ThierryBerger avatar Feb 28 '25 08:02 ThierryBerger

I tried to do the interpolation on my own, and although the interpolation itself did work, the physics did not work correctly. Going up ramps felt like I was moving in to the ramp at times and going down ramps didn't actually snap me down the ramp and instead just moved me into the air. That makes me think that doing the interpolation in rapier is a much better idea.

Jakkestt avatar Feb 28 '25 14:02 Jakkestt