Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 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.

alt text

Product Version: UE 4.9
more ▼

asked Oct 13 '15 at 04:26 AM in Blueprint Scripting

avatar image

18 7 12 15

avatar image Jacky Oct 13 '15 at 01:13 PM

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

avatar image Rhiannonnee Oct 13 '15 at 11:26 PM

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?

avatar image Jacky Oct 14 '15 at 12:17 AM

Like this:

alt text

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.

parallax.jpg (80.0 kB)
avatar image Rhiannonnee Oct 14 '15 at 12:59 AM

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?

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

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.
alt text

more ▼

answered Oct 13 '15 at 02:40 PM

avatar image

1.2k 58 12 62

avatar image Rhiannonnee Oct 13 '15 at 11:25 PM

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.

(comments are locked)
10|2000 characters needed characters left

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

more ▼

answered Oct 14 '15 at 09:40 AM

avatar image

1.2k 58 12 62

avatar image Rhiannonnee Oct 16 '15 at 11:16 PM

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!

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question