Help with Event Tick and Set Location

Hello everybody,

I couple of days ago, I was able to add parallax scrolling to the background in my simple 2D platformer game, thanks to help with [another][1] question on this site. But now I have a problem with the way the background moves when my player character stops.

Basically, the scrolling works by having the background’s location update every tick. The background only updates if the condition that my player is moving is true. It all works fine when my player starts moving. But when they stop, the background jitters very slightly to the side.

I think this happens because the SetActorLocation node isn’t done updating at exactly the same moment as the character stops moving, so it does one last update to snap the background into the latest location it received before the character stopped moving. I’ve tried to think of some ways to stop this from happening, but none have worked so far.

Does anyone have any ideas as to how to stop this and make the background scroll smoothly? Thanks.

1 Like

Just a guess; parallax speed may be causing the jittering. What happens if you use Delta Seconds instead of that?

The Set actor location work in perfect timing,
To avoid any problem and try to add also the vertical parallax i sugget you to check the position of the character.
And just set the BG to the inverse position of the character.
here a working example,

You can easily add the same control to the Z and get the vertical parallax…
You can also move divide the Y of the player by 4 , to move the parallax 4 times slower, .
putting multiple BG actor at different distance and dividing by 1 4 8 theyr Y you will get the “forest parallax”
where the most distance trees move slower and near tress run fast.

Thanks for your answer! It works for making the background move more slowly, but it still does the little jitter when the player stops moving. Also, I’ve noticed that the jitter only happens when I have the background scrolling really slowly. When it’s scrolling a bit faster, the jitter can’t be seen.

Hi Jacky, I was wondering if you could tell me how to use delta seconds in place of the parallax speed variable, which is currently a float?

Like this:

But nevermind that i guess. Try connecting Event Tick directly to Set Location. That bool you are using for the branch may be causing a lag depending on how you are firing that CharStopped custom event.

Thanks for your reply. I tried using a blueprint like the one you showed, but unfortunately the jitter is still there. I also tried Est_engine’s method from below, which eliminated the branch, but that didn’t work either. So far, the only way I’ve seen that stops this is changing the camera mode to perspective, but I’d rather avoid that as that will bring about its own issues. Do you have any other ideas for how to fix this?

I get a perfectly smooth movement with that blueprint , maybe the problem is in the player movement?
try to use my blueprint on something that move perfectly , or , try to draw a cross in the player location , using the draw debug line… just to be sure that the jitter isn t in the player coords.
other this i dont know where to find the problem ,
good luck

Thanks for your suggestions. I actually just decided to give up on this blueprint and switch the camera to perspective mode. It seems to be working pretty well now!