Infinitely Scrolling Road

So I’m currently trying to convert my Unity game over to Unreal. The “hub” of the game is an endlessly driven road and you use a phone to access other areas. So in Unity, I have 3 long road tiles and they just scroll towards the camera at a given speed (scrollingSpeed) and when they get to a certain point (roadSegmentOffsetStart) they just move forward by a certain distance (roadSegmentOffsetDistance).

The road gameobjects are just kept in a list and every frame I iterate through the list and scroll the road piece backwards and check if it’s met it’s threshold to be translated forward, creating an ever scrolling road.

The camera by the way just remains in place. I found a Unreal tutorial of an endless runner game hoping that would help but I couldn’t figure out how to apply that to my use case as their player just ran forward and the road spawned infront of them. Now in Unity infinitely scrolling forward like this throws floating point errors and eventually makes everything disappear as your axis value gets in the millions so I want to fake it by just having everything in place, scrolling it back, and moving it forward when the camera can no longer see it.

How would I achieve this in Unreal Engine

I’m sorry if this was a little ramble, but I’m not entirely sure on what information is useful and appreciate any help.

Unity Script included if that’s helpful at all.



using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class WorldScroll : MonoBehaviour
{
        [SerializeField] private float scrollingSpeed;
        public List<GameObject> roadSegments;
        public float roadSegmentOffsetStart;
        public float roadSegmentOffsetDistance;

        private void Update()
        {
                for (int i = 0; i < roadSegments.Count; i++)
                {
                        //Infinitly Scroll By Set Speed
                        roadSegments*.transform.Translate(Vector3.back * Time.deltaTime * scrollingSpeed);

                        if (roadSegments*.transform.position.z <= roadSegmentOffsetStart)
                        {
                                roadSegments*.transform.position = new Vector3(0, 0, roadSegments*.transform.position.z + roadSegmentOffsetDistance);
                        }
                }
        }
}


Hi man,
you can totally make this road game with the ccamera stand still and the road scroll.
But i would suggest you to mix the two way.
Instead of warp every small piece of road to cycle, (that could be hard keep track of the object and obstaccle you spawn)
Create section of 10 roads, and add a “Gate” to warp back to the origin.
This kind of system you want to use could be impossily complex to set up during curves !

By the way, for making the road scroll toward the camera like you asked:
You can make a new actor with only the camera component in it, use the event begin to “set view target with blend” to set this camera as main.
Now you cant move anymore , if you play with wasd, you could see the defaultPawn move in the level XD
Add another actor and call it road,
add a mesh component of your road ( a straight road, curved roads will be a mess )
Your mesh should be “tile” have something modular to know where snap back, if not, just add 2 roadmeshes, and put them straight.
Now is really simple. lets go in the tick event
You have a road of 100m ? make the a**ctor move with Addrelativelocation by something like 5 **. (suggest you tu get a int and multiply it for the deltatime to have a constan speed at any framerate)
now your road moves endlessy.
Addd a check if he actor position x, or y is larger than 0, if it is, **set actorworld location back to 0 0 0 **