First of all, after way too much googling for a week I found that this should always be true:
Update() check for input
FixedUpdate() move gameObjects that have riggidbody/apply forces
LateUpdate() move Camera
So that is what I did. I move my character in FixedUpdate() and my Camera in LateUpdate(). That causes jitter, of course, so I interpolate the character’s rb and it does the trick. Everything is smooth as hell.
Now, I try to do the same with the moving platform. I move it in FixedUpdate() and I set its rb to interpolate… but idk why, it jitters anyway, no matter what… when the player gets on it, it gets patented by the platform via Setparent but the jitter is horrible.
So, the cause of that problem is obvious. The platform is moving in FixedUpdate() and the camera in LateUpdate() so their timesteps don’t match and the only way to fix the problem would be to interpolate the platform’s rb, but it won’t work.
What I have tried to solve this issue:
I tried to change the platform’s movement method to Update() so its timesteps would match with the camera’s LateUpdate() one… and it works perfectly!!!
Now the problem comes when the player tries to get on it. If you stand still everything is smooth, but when you try to move, the player’s speed is so slow that you can barely move. It is like the player inherits the platform’s Update() function and overrides the player’s Fixedupdate() and because the player’s speed depends by fixedDeltatime, it won’t work in an Update() function.
I have also tried to set the camera to FixedUpdate() and turn off all interpolation… everything jitters
I have tried many other things but I think the problem resides in their timesteps.
The solution I found and I dont like:
Instead of moving the platform via script, I tried to animate the platform. It jitters like when it was moving with FixedUpdate(). However, in the animator component, there’s a setting called update mode. I set it to animate physics to get rid of the jitter as the interpolation would do… and all over the sudden everything works smoothly, even when the player gets on the platform and moves or stands still…
This is not the optimal solution because you would have to create an animation for every movement behavior, like going up and down instead of left and right and so on…
I dont know if this is a bug or there’s something I’m missing…