Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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)alt text

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 alt text

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! alt text

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!

Product Version: UE 4.14
question01.png (115.5 kB)
question02.png (279.7 kB)
question03.png (190.7 kB)
more ▼

asked Feb 02 '17 at 03:07 AM in Blueprint Scripting

avatar image

35 4 5 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

more ▼

answered Feb 02 '17 at 03:38 AM

avatar image

1k 37 12 38

avatar image Sharkafuc Feb 02 '17 at 04:00 AM

oh!thank you very much!i have accessed the inside of the loop node,and i realize what the problem is:the loop counter and the array index are different variables and they increased in a sequence!No wonder!thank you very very much!

avatar image MonsOlympus Feb 02 '17 at 05:30 AM

No problems, if you feel this adequately answered your question Id ask you to mark it as resolved please :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Feb 07 '17 at 12:57 PM

avatar image

Lord Caine
91 4 9 13

avatar image MonsOlympus Feb 09 '17 at 07:11 AM

You wont have access to the delay node in libraries extending from Object as its only available at Actor level.

I did stress the importance of not modifying the original files that come with the editor.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question