# Continuous movement looping

Hi Swim,

You could do this with or without matinee. Additionally, you could do this all within vertex shaders and skip blueprints entirely if you wanted. That would probably be my first attempt.

That said, the end train level in Gears of War 1 actually used the matinee method where several ‘track + background’ level variations were leapfrogged around the player view. In that case the scripting logic was required since you passed through tunnels and the level turned to night time at the end of the tunnel. For a simple looping animation I would probably do it all using materials.

The basic setup would all be using Vertex Shaders (worldposition offset input in materials). In its basic form, you take a Vector (ie the direction of scrolling. 1,0,0 would be positive X movement) multiplied by Time and then take Frac of that to get a looping time gradient over 0-1. Then you biasscale that into the -1 to 1 range and multiply by total Movement Range. That looks like this (hooks up to worldposition offset):

If you want everything to use a single speed value you could make it a global material parameter value. Then you would want to figure out your total movement distance by configuring the movement and speed for your furthest background elements first. If your project is actually orthographic then you will need to fake the ‘distant’ elements being distant by simply having them move slower. That is probably much easier than having the distant planes further away but both approaches could work.

I am trying to construct a title screen for a project that I’m working on; on this title screen will be a car that appears to be moving constantly to the side, from a side-scroller-esque perspective. The way that I am currently working on accomplishing this is by having multiple custom rock models scroll across the background, and teleport from one side of the screen back to their original starting point once they leave the player’s view.

The movement that I am thinking of is very similar to the gif shown below of the Wario Land 4 title screen - the rocks in the background would continuously loop while keeping their spacing whenever they go offscreen.

One of the major problems that I’m having with this, however, is that I can’t make the rocks move at all without using a matinee to put them on a set path, though with a matinee I can’t make it loop smoothly the way I want it to.

Any help at all on how I could do this would be greatly appreciated.

//Video showing proper background rock looping (around 1:22) Warioland 4 HD [ Intro Title Screen ] - YouTube

Thank you very much for leaving this reply - I didn’t expect one so fast!

I will try this approach as soon as I can, though something I forgot to specify is that I am doing this with a complete 3D perspective, unlike the 2D title screen which was referenced; would I still be able to do a looping effect using materials and 3D meshes?

Sounds great! Thank you again for the help!

Yes, the above approach still works in 3d. you just need to make sure that “movement distance” is large enough so that you don’t see objects in the distance pop in or out of frame.

and in 3d, distant objects will have to move much further than foreground objects. So you might opt to use different settings for movement distance or speed for foreground and background objects unless you want to build everything for the background object settings. That will just require you to use more foreground objects since they will spend more time offscreen.