Consecutive actions using the same trigger

Hello community

I’m attempting to construct an animation for VR, that would show the consecutive stages of construction for a pavilion. I am having difficulties with using he same trigger (eg. mouse click) to spawn/set translation of the consecutive pavilion components. I do not want one action to trigger multiple events at the same time, but the same action to trigger consecutive events.

An example of the goal - LEFT CLICK and a wall appears, LEFT CLICK again and a second wall appears. LEFT CLICK a third time and a ceiling appears.

Thanks

to get that type of functionality you are going to want to use a multigate. a multigate executes the exit pins in order, so on the first time the node is called it will execute pin 0, then the second time pin 1, etc. so in your case each time you left click it will fire a pin in ascending order, click 1 = pin 0, click 2 = pin 1.

you could also do the same thing with a variable and a switch node but the multigate is probably easier. but in case your curious the way with the variable is that you have the variable set to zero and every time you have your input you increment the value of the variable and use that number as the index in a switch or select node.

And if you have a TON of steps to the construction, then I’d put all the pieces of each one each into a struct containing it’s start and end states (translation or hide/show) and the assets themselves, and put each struct into an array, and put each array into another array. Then you can just run one function that does everything by looping over the arrays and using the information in the structs, and it knows which array to look at and move all the pieces in it, based on which index you pass into the array that wraps around THAT. And each click can just increment the outer array index that is used to access it.

but if you have only a dozen or so steps instead of like a hundred, then use ThompsonN13’s technique as it would be more intuitive.

ThompsonN13 thank you very much for your reply, this is exactly what I was asking for and it’s very useful to know.

mightyenigma, thank you so much because this is not was I was looking for but it is exactly what I needed!!

I would really appreciate it if you could elaborate a tiny bit more, maybe with a couple of screenshots of how to organize this. For example, a few questions come to mind

  • would i set this up in the level blueprint, or create a separate blueprint for each static mesh?

  • if i have let’s say an animated buildup of all the layers in a wall, could I then animate that whole constructed wall as one object? (without applying the translation to each individual wall layer)

THANKS AGAIN

I think you can do it all in one level blueprint as there is no special logic needed to be taken care of by the individual meshes (youre just turning their visibility on and off)

For using on transform to animate a whole composite of many pieces I am not sure the best way. probably either use Attach actor or Attachh to Socket OR
make all the parts that should move as one be Components of a main one.

I’m not where i can set it up right niw to make screenshots for you.

but for my idea the basic unit is a struct let’s call it “BuildInstruction”

{
Static Mesh reference “MyMesh”,
Transform “StartPlace”,
Transform: “EndPlace”,
}

You can create an Array of these in your Level Blueprint and fill each entry manually with whatever Meshes and their associated start and end locations. This will form a group of pieces that will all move at the same time.

Now this next part is where I dont know if my idea will work - eaxh one of these groupings / arrays is to be put inside a single “Master” array. that’s thw one the user manually loops through via clicking the button, thereby activating each group array. I dont know if Unreal lets you pt arrays inside arrays but i think it does. I hope it lets you do this nested thing manually because then basically you end up having just one variable “Master Array” in your level blueprint, which has your arrays of “BuildInstruction” structs in each of its index entries.

Well two vars because you need an integer “MasterIndex” to keep track of which group of building pieces comes next.

On mous click you access MasterArray at MasterIndex and pull out the Array there, And then you loop theough that array and in that loop access each Struct and Lerp the World transform of each MyMesh from StartPlace to EndPlace.
Also increment MasterIndex so it will do the next group next time the button clicks.
All this looping stuff is what your one BuildThingies function will do as response to the button click.

If you can attach or use components to make certain groups all one piece then you can have just one array instead of an array of arrays.

I’d love to see a video of it in action once you get it working :slight_smile: