BP Sequential Animation With OverLap

Hello all,

I have read all the “similar topics” and search for my issue on the web but could not find anything conclusive. How someone can help me.

As shown in the Event Graph below, I am trying to animate a series of actors (ObjectArray) one by one using the timeline.
I have a Sequence with 2 steps. 1) I trigger the animation selecting an Object via ObjectArray[CurrentIndex]. 2) After a small delay, I modify the value of CurrentIndex and, if CurrentIndex < ObjectArray Length, I repeat the loop (to go Step 1).

ObjectArray can have 10 or 200 elements.
CurrentIndex default value = 0.
MyTimeline length is = 1sec… therefore with a 0.1sec delay, there are a max of 10 simultaneous animation.

I think that by updating CurrentIndex before the animation is completed, MyTimeline interrupts the animation to start the new one (I have one 0.1sec animation instead of 1sec). My goal is start N animations and being able to make them execute to entire animation length.

Have you had the same issue? How did you solve it?
Thanks a lot for any answers: I am spending a lot of time on this as I don’t have much experience with BluePrint…

so if I am understanding the situation correctly this is a single trigger that will have multiple actors all perform the same animation in order but all offset from each other?

constantly quarrying the bounds of the array can get computationally expensive in blueprints, so instead of manually iterating over the array the maybe a ForEach Loop and instead of having to call ObjectArray.Get() you can just take the element from the ForEach Loop

I added the isValid just to make sure that it isn’t current null/none which would cause a crash in best case.

1 Like

also keep in mind that by triggering all of these animation in begin play with a delay can lead to the game actually starting while the iteration is still in progress meaning that it could be in any random position within the array one the first render frame of the game depending one the random order that begin play can be called.

Thanks for trying! I’ve found a way to show what your script does. Your way is probably more efficient and I’ll use the For Each Loop, but I found out the problem lays in the Timeline. Here’s an animated gif: (it should only repeat 10x)
YourScript

While working on my problem, I found the Timeline cannot work in parallel. Even is you create a Function and pass the values. By the way Function don’t accept Timeline but you could create an external BP, put it in the scene and call a Custom Event via "Get All Actors of Class → BP_Animation). It will fail… :frowning: Animations cannot overlap.

I’m trying to have multiple instances of BP_Animation and calling unique one/currently not in use. I think is an ugly solution but I have none other.

I’ll let you know is it works. If you have another idea, let me know.

Could not find anything useful… Any suggestions?

you “could” reuse the Timeline if they were all to be in lockstep (so triggering all of them at once by just removing the delay)

if each one is to be at a different point on the timeline, then perhaps moving the responsibility of tracking the timeline from what appears to be the manager to the actor itself. instead of calling the timeline in the manager to update each actor based on the timeline. have the Manager call the EventStartAnimation

maybe an “Event Dispatcher” which is Blueprint’s version of a Delegate. each AnimatingActor would then have a float TimeOffset, float Accumulator, the timeline, and a state control variable (I like enums which if derived from byte/uint8 have the same memory space as a bool and can have up to 256 states where each bool only has 2, even if the enum is derived from int32/EngineInt it will still take up the space of 4 boolean variables)

you can look at this reply by Everynone as how to bind Event Dispatchers How can I call an event from another Blueprint? - #4 by Everynone

if the Array of actors is to be consistent then in the ConstructionScript() iterate over the array assigning binding the event that will be dispatched to, and set the value of TimeOffset() then in your trigger Event for the Manager call the EventDispatcher which will Broadcast to all the Bound Events.

now in Event_Tick() monitor the state control variable and the TimeOffset (based on the DeltaTime being fed into the accumulator) considering that Timelines, and Animations already use the Engines Tick you are not really saving that much by using a Delay but having the activation of it being outside of the “Input->Logic->Physics->Logic->Render->Logic” engine loop where you can get inconsistency with the varying frame rate.

when the accumulator has hit change the stateControl variable and start the animation/Timeline.

It took me some time to understand and imagine what you meant but I think it is the way it should be done. Thank you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.