Loop for a spline

Hello there,
So I’m trying to make an object to follow a spline in a loop. As of right now, I’ve got the object to follow the spline but it only does it once. Whenever it does goes around the spline it stops. Please help me. I’m pretty new to Unreal Engine 4 and all the blueprinting stuff.
Here is the blueprint that I have so far.

Thanks!

Hello ,

Had never thought about moving a object along a spline in this fashion, especially as the “Event BeginPlay” is only called one time. Hence the “Time” node must be invoking to keep the movement going (assuming that the movement is not completed in just one call, I.E. the object moves from the start point, to the endpoint with just one call, which if that is the case, the Event BeginPlay is your issue, in that it will only be called one time).

Personally I would set it up to be driven by a Timer, or the Tick. I would in the Event BeginPlay, grab the length of the spline (if it is not changing at run time), and just store that off in a variable, if I needed it, or during the construction of the spline if that is being done at Construction time of the Blueprint).

If you know the object is being moved more than one time before it stops moving, then I would suggest that the value that you are using from the Animation Pin, from the Time Node, has went to a constant value, hence it would look like it was not moving, because the value is never changing. OR The Time node itself is no longer being called. Either of those would stop this blueprint from working as you desire.

But if I was you, I would choose another way of driving the movement, unless you are using some animation that is important to you.

Hope this helps,

While I fully agree with and this approach would make more sense in some / most scenarios; you can loop the Timeline easily with a CustomEvent, like so:

Try adding WhileLoop to the Graph.

that is a bad way to try to accomplish this. using a while loop here would be bad on so many levels. first a while loop like all loops runs between frames so this could easily cause a slowdown / stuttering. next looping a script back on itself like this is not a good practice, it makes things messy, hard to read, and can cause more issues. if you really wanted to create a loop like this (not that i would condone it) you would be much better off using a delay node instead as it doesnt contain nearly as much logic.

the proper was to accomplish what the asker wants would be to use a custom event to loop the script as show by everynone or by creating a different movement method as mentioned by jayice.

Also, the Timeline can be just set to Loop if it’s very simple looping one is after.