Hello, guys.
I'm here to address one of the issues students text me about.
It's parallax background.
So student says when player runs ahead, the pull up the parallax background waves or flicks.
I don't know why.
Maybe camera ratios.
I share the video and actually I didn't need to watch the video because I know what he's talking about.
I faced the issue myself long time ago when I was recording this course for the first time, and I was
afraid I will not find the solution and I cannot release a course with such a bug.
But actually it's very easy to fix and solution is simple.
And the reason it's happening is also very simple.
It's very simple to understand.
First, I want to show you.
What he what he means.
Let's see.
And the video is very lucky.
But still we can see the background flicks a bit shakes like that.
And I have same on my project just a bit, especially if I go to Player's rigid body and change it from
interpolate to none.
You can see here.
Where of my background?
Over there.
Right.
So that's what they're talking about.
Another student texted me with the same issue a while ago, and that's when I decided I need to make
a video about it for sure.
So it says he's in the background section and he's stuck because he cannot find the solution even when
he uses different parallax code on YouTube.
His further background tilts jiggles, shakes when he moves.
So first of all, I'll show you a quick solution If you just want to know how to fix it.
You don't want to know why it's happening.
And actually, I showed the solution in my videos.
It's very basically the same.
But maybe it didn't help you.
And I'll try to explain one more time.
First of all, you need to set your rigid by this to interpolate.
Interpolate.
This is important.
This is very important to do this.
Second, you go to your main camera fine tuning machine brain change update method to smart update and
blend method to later update.
If it doesn't help you try to play with this, try to set up late update and late update here and just
click these two couple of times.
Maybe something will work better for you, but this what basically should be to make it work, I'm pretty
sure.
And.
Even after you do this, you still may experience some deterrent effect, but it's going to be there
only in unity.
Ed Even in my videos later in the course when we setting up the canvas before we do the skybox, there
is still some jittering of the mountains in the background and it is because of the unity.
Only if you click over here to the stats, you can see your performance, space and CPU.
And for some reason, I don't know if it's going to be there now, but sometimes for some reason when
you move your mouse, unity has low performance issues and now it's jitter in the glitching.
If I check my mouse, you can see my f-pace getting slightly lower.
Not so much, but still it is there lower than it should be.
And you can see MZ over here, the delay, it's getting up to six and seven.
Again, it's not a big difference, but it's enough to make it lag on the background and if you thump
the play mode and if you build your game, I'll go find, build and run.
Look, when I build my game, I click top to start.
I have no jittering on the background.
It's all fine.
You see, there is no lags, nothing.
It works smoothly and nicely, basically perfect zero issues.
So this is happening because.
Mostly because of the unity ed and its own performance issue.
So do, as I said, set up your rigid bodies to interpolate.
Does that be a blend method on the cinema machine brain and make sure you have movement done in the
update function.
I'll show you what I mean by that.
If you go to background Parallax on our script here, you can see it's done in the update.
Player movement.
Then in the update.
Everything done in the update now smoothly, I'm going to transfer to explaining why this happening
at all in the first place.
You can actually ask this question in Google, and that's how I found the solution long time ago, like
more than a year ago.
But now it has like more short answer to the issue.
So they basically discussed in same problem here determine problems with my camera.
When doing a 2D parallax effect.
I will leave link to this thread in the description.
You can also find it in Google just by typing jittering background unity.
There are lots of links discussed in this issue.
Basically what they say is make sure you move in all objects, either in the fixed update or update.
Don't mix them or you'll have endless headache.
Then they discuss in some particular issue.
And then Gregory from Unity Technology says since rendering is done on the update, late update clock
same what we did here in the machine brain if you remember.
Yeah.
It's preferable to move all objects on the clock in order to reduce analyzing if you can.
A good solution is to enable interpolate on rigid bodies.
This will interpolate the transform physics between frames so that the position are appropriate for
the current render time.
Then you can run all your cameras in the late update and there will be no jitter.
And that's what basically we did.
If you remember, in the beginning of the course, I explained that there is a different type of update,
fixed update, update and late update.
So what he's saying basically is you need to decide how you're going to move your objects in the fixed
update or late update and make sure you do it same across all of the objects in the game.
And we chose update for that fixed update called 50 times per second by default.
You can set up that in the edit project settings.
Find the time over here.
This is fixed time step.
This one means it's called 50 times per second.
If you want to make it called like five times per second, you can just increase the value and update
can be called according to your face.
If my space is 140, I'm going to be called 140 times per second.
So yeah, I hope I explained why this is happening.
It may happen because your objects moving in a different update or because you did not set a rigid body
to interpolate.
Make sure you do that.
Make sure you set up your cinema machine.
And even if it's happening after you did all of that, just make a build and see if it's still happening.
If it's not happening when you build a game, then it's fine.
You just work in unity, ignore it, and when your game is done, it won't be there.
All right.
Thank you for your attention.
It was a lot of talking, none of nothing of coding, basically.
But I see some people are getting confused.
So I tried to cover the question here.
I try to cover the issue.
Check out the other courses.
I'm releasing RPG course very soon.
I hope you'll like that.
It's going to be cool with the craft system and skill tree enemies Combat axe.
So many cool stuff.
So you.