So I think there is an issue with my logic. I’m basically trying to find a way to have multiple moving blocks or platforms. I have no issue doing this with multiple blueprints, but there MUST be an easier way to do this. I want the objects to move from point A to point B, I have the timeline set up and i have a single object doing this with no issue, but I didn’t want to have to create a different reference for EACH moving object. The best way to explain is like this:
I want Object_01 to move from Point A to Point B on a vertical axis.
Object _02 will be 1000 units down the X axis from Object_01, and will move between its own Point A and Point B.
Rather than create a separate Sequence for each of these objects with its own reference points, it seems like logically there would be an easier way to achieve this. I thought of using an array of the objects and then just using a ForEach loop to set the start and end point, but then each run through the loop would have to have a different Start and End point, leading to the same issue in a different area.
To reiterate what i’m trying to achieve, I want to be able to have as many objects as i want in my level move on a Timeline loop from point A to point B, but each object have its own Point A & B without having to have a ridiculously sloppy level blueprint filled with references galore.
This is a screenshot of the Level BP i have that works for the single object at this point. This works for the one, but i’d have to set this up for each running a Sequence to have multiples. I know i could create a function for the bulk of it and then just call the timeline in the middle, but is there an easier way?
Give each object the start/end locations and its own curve. Then use a global time-elapsed to drive them all. When they spawn they get added to the list. Then, on tick (or timer), go through the list and tick each one. The alpha will be the same for all of them but each will be able to follow their own curve between their own start/end points.
That would be a more dynamic way to do it. But the simplest way is to use multiple tracks in a single timeline to drive all the objects. If you know you will have a (low) fixed number of objects, this might be the easier way to go.
So this is what i was essentially trying to avoid. I went ahead and did it for the sake of being able to give a better representation of what i meant. How would i thin this out? It seems like this is a lot of BP for moving only 3 objects. I’m not really understanding what you mean. I get the concept of it, but i don’t know how to assign each object to the timeline without adding references as i’ve done in the following ss.
My first suggestion would mean that instead of using the Sequence to handle each one explicitly, you add them to an array (i.e. at BeginPlay). Then you replace the Sequence with a ForEachLoop that goes through the array and applies the Lerp to each one in the same way.
Your image is very blurry so I can’t give anything specific to your code, but that’s the basic idea.
The timeline suggestion was assuming you weren’t Lerping – that each object needs to move on its own curve. For this, you open the timeline and add more tracks, one for each object you want to move. If any two objects can share the same curve then attach them both to that track. Lerping a timeline is a bit redundant so either use the timeline curve or use an elapsed-time counter to drive the Lerp.
Okay, i see what you’re saying now. But they all use the same time curve, therefore the Lerp can absolutely be done with a ForEach loop, which I will change to. But what about assigning the start and end locations for each object? Are you suggesting assigning the start and end to the object itself rather than in the Level BP? (I’ll add 2 closer SS to make it less blurry, my apologies. I’ve added one of each side)
If the objects have their own BPs then you can add the start/end locations variables to those. You could also keep two more arrays in the level BP: one of start locations and one of end locations. They should match up index-wise to the array of objects. Then you can use the same index for the start/end arrays as you do for the object array.
Give me a few minutes to work with this. If i can get it all put together, i will mark this as resolved and up it. I have the logic of it down, but since i have 3 movable child objects, i only have the child BP to work with and i can’t set the start/end locations for each, only for the first one. So i’m trying to put all the Start/End locations into an array and then figure out how to break the index into a location vector to plug into the start location set for the actor.
So basically on Event Start i had the level BP “Make Array” for each object, each StartLocation, and each EndLocation, creating a variable array for each, then ran it into the timeline and set the Alpha to a variable.
After that i went to Event Tick and ran a ForEachLoop with the Object array as the Array. Array Element Output ran to 2 SetActorLocation functions, and the Array Index to 2 separate GET Array (one for StartLoc and one for EndLoc, the array variables i had created earlier) and ouput the GET’s to their own GetActorLocation. I’d go into further detail, but i think a SS will suffice for anyone that has this issue in the future.
Much cleaner and functions perfectly. Thanks so much for the help!!!
Glad to help. Just know that looping on too many objects every tick will cause performance issues at some point. You can instead create a timer and set it to tick fast enough to animate smoothly but no faster.