how to make the delay in foreachloop
i want to realize an effect that a ball can move following the trajectory i have accumulated.(when press the key f, the ball will appear at the location of this cube and move according to the green curve)
so i have accumulated each position of the ball will stay in the trajectory.(there are 10 locations stored in an array variable named "TracePoint"),i use a foreachloop node, and change the location of the ball in the loop body. In order to observe the ball. i use a delay node for 1second delay
and here come the question! in the debug mode ,we can see the program can reach the delay node but can never reach the setworldlocation node until the foreachloop completed. so the effect of the program is wrong: the ball appears at the location of that cube, delays for 1second and suddenly appears at the final position,it skips all the locations during the loop!
in another way , i use the timer in foreachloop for instead. but nothing changed.
so, how to make the delay in foreachloop? or is there anyway to realize the effect i want? any help will be really appreciated!
asked Feb 02 '17 at 03:07 AM in Blueprint Scripting
I think the typical way to do this is to copy the ForEachLoop macro into your own copy then add the Delay directly to the loop. You can get access to the ForEachLoops internals by double clicking on it, I must stress the importance of not modifying the original though so be sure to copy that to your own macro which you could create inside a Macro Library which will give you access inside any BP in that project you create.
answered Feb 02 '17 at 03:38 AM
For anyone else that might read this you need to set up your own macro outside of the standard macros library or you won't have access to the delay node.
These maybe inherently obvious to veterans but it was not to me.
I built my own macro, based on the foreachloop within my blueprint and the foreachloopwithdelay works great now.
answered Feb 07 '17 at 12:57 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here