Help with Event Tick and Set Location
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.
asked Oct 13 '15 at 04:26 AM in Blueprint Scripting
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.
answered Oct 13 '15 at 02:40 PM
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
answered Oct 14 '15 at 09:40 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here