Why is the paralaxing shaky? (video examples)

https://drive.google.com/file/d/0ByYKDNm1mq0dVFNkZWlyZFV1ZVE/view?usp=sharing - 1st vid

https://drive.google.com/file/d/0ByYKDNm1mq0dY0ozcEtrck1vMTA/view?usp=sharing -2nd vid

ObstacleMovement.cs - Pastebin.com -the script for the obstacle movement

Parallaxing.cs - Pastebin.com -the script for the background movement

Why does the movement lags so much? It’s not from the laptop characteristics for sure (lenovo g510 i7 4700MQ, gpu radeon r7 265m). So this means it’s either from the code although I see no reasons or smth else I’m doing wrong. Note how on the second video when I’ve reduced the gameSpeed 5 times still the platforms are shaky

UPDATE: It appeared that it’s from the backgorund itself I removed the obstacles and found out that the backgound is the one that is shaky also left only the obstacles and they were fine so there’s something wrong with the background. It’s not the texture I changed the texture also. Tried to create a new project just to try the parallaxing and appeared that the same problem is there also …

Your platforms are moving using velocity. That means their position is being updated on FixedUpdate(), which is called ~50 times per second by default.

Your background is being repositioned on Update(), which is called once per rendered frame, which could be quite a lot more often if your framerate is high.

The difference between these two update rates can create judder like you’re seeing.

For example, if you render at 30 fps with a physics step of 50 Hz, there are 5 physics updates for every 3 rendered frames; that means two thirds of your frames have 2 physics steps between them, but the odd frame out gets only one physics step (so the platforms seem to move less in that one frame compared to the others, making their movement look shaky).

One way to deal with it is to enable interpolation on your platform rigidbodies. What this does is offset the rendered transform in-between physics updates to give a smoother appearance. Interpolation: Extrapolate should predict correctly if your platforms are always moving at a constant velocity as shown here.

Switching both background & platforms to update the same way (either both in Update or both in FixedUpdate) will also fix any discrepancy between them, but might not be practical depending on their gameplay needs.

A more reliable fix is to move your camera instead of every co-moving object independently - fewer moving parts, fewer things can go wrong, and there’s less data to interpolate. :wink:

How is the build performance though? I find everything is more fluid in the builds, from my experience. I thought this was normal because the editor is still running.