x

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"

ForEachLoop and Timeline for procedural looping animation of spawned components

The Concept I am creating a relatively simple cloud spawning blueprint tool, and when I input an integer it spawns static mesh components a set distance apart. This is working already inside of my construction script.

I want the static meshes I am spawning (so they are components attached to a central parent), to bob up and down. The way I would figure I would do this is with a timeline node used to change the relative location values of the components. The only way I can figure I can store these components and call them is with an array and a ForEachLoop, which is where I run into my problem...

Question/Problem:

Since a ForEachLoop runs instantaneously, it doesn't update the timeline in a looping fashion- instead I can only seem to get it to update either the first or the last component in the array. How can I call to the spawned components, and set them to loop a simple up-down, lerping animation?

Attempts I've tried running it on event tick, timeline updating for each loop, for each loop triggering a custom event, and just various attempts at variable changes. Nothing seems to work. I am figuring at this point that I may have to spawn blueprints inside of the "master" blueprint, and set the ForEachLoop (in the master) to trigger the timeline inside of the spawned components through a custom event. It just seems like that may be a less efficient and more expensive way to do this.

TL;DR How can I spawn a random number of components and set each one of those components to loop an animation?

It goes without saying, that any help is much appreciated.

alt text

Product Version: UE 4.10
Tags:
more ▼

asked Jul 04 '16 at 12:29 AM in Blueprint Scripting

avatar image

Rgerson
55 1 3 8

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

1 answer: sort voted first

Did you try to do a foreachloop within the timeline so that it moves all the spawn components and move them all at once rather than one at a time?

more ▼

answered Jul 04 '16 at 04:58 AM

avatar image

SkeetonYu
405 18 11 31

avatar image Rgerson Jul 04 '16 at 07:18 AM

Thank you! That seems to have worked. I want to make the clouds bob a bit differently, so I was thinking in terms of setting it to make each one set individually, but instead i'll just set up branches based on the array index of the forEachLoop to assign the variations. Thank you so much- you've been a life saver on something that was giving me too much of a headache!

(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