How do I randomize the movement of meshes in an array? {Resolved}

Hello,

Still very new to unreal and programming in general so excuse me if this is a silly question. How do I randomize movement of individual meshes in an array of static meshes?

I have a hex grid type map that floats around a bit on a platform loop move to function to give it a more lively feel. The hex tiles are spawned in on a grid with a blueprint via add static mesh component, given them various heights, added a move to component, colored them separately, and added them to a hex tile array, but I’ve been unable to figure out how to move each individual component in the array separately. Each mesh instance is moving together all at the exact same time.

I’ve tried to use randomized delays and randomized retriggerable delays along various parts of the platform loop path to insert some sort of timing offset to each platform’s move loop, but I haven’t been successful. I also tried to run a for each loop with a random delay in a few spots around the platform loop that called for all actors of the class to somehow individually select each one and randomly offset the platform move start timing.

No matter what I’ve tried they always move at the same time together.

Should I have used the add instanced mesh component instead? Was I supposed to use some sort of timeline node? Is there a bigger picture I’m overlooking here? Was I inserting the for each loop delays in the wrong place? Set timer by event node?

Would be thrilled to hear from someone who may have a solution to this hurdle I encountered in my learning.
Thank you for taking the time to help out. Much love.

I stripped out all the failed attempts out of the blueprints so I am now left with what I have below.

Here is my construction script:

Here is my event graph script:

Here is what I have so far(sorry for no gif but the platforms move slightly up and down together):

I haven’t read this question in its entirety, so excuse me if I miss, but I think I know what you mean.

It’s an impossible nightmare to write code that controls all of these things randomly, in one place.

The answer is to spawn a small controller process that animates the meshes, one for each mesh. That way, each process has its own timeline etc and is very simple to write.

Thanks for taking the time to try and answer. I ended up figuring some stuff out last night. I was trying to write all the implementation in the array blueprint ( in one place like you said ) , when I needed to use another blueprint to wrap that functionality in it and then spawn the grid mesh element as a child actor in the array.

Now when the character steps on a platform, it triggers an individual color timeline loop that cycles through some hues. Each platform can now individually process physics too! Adding randomized motion to each would also most likely be done in the same individual bp through timelines then called into the array, but I have yet to implement that. Probably will get to it today. Thanks again ColockworkOcean!

Much easier, eh? :slight_smile: