Anyone know how to do for loop in Niagara?

I’m trying to do simple for loop using vector array in Niagara module but can’t find a node corresponding to that. I also tried for loop using HLSL but it seems it’s always computing last index.

Anyone was able to create for loop in Niagara Module?

I have leaves that are just sitting on the ground. I’m passing characters’ velocities and locations to the module to add forces to the leaves like in Ghost of Tsushima like of particles. So basically I need to make for loop using vector array to get it working like in GoT.

Currently, the leaves are just reacting to one vector - last in the array even when used HLSL code with for loop.

(for example they are only reacting the player, not the enemies with the player as well)

What do you want to have happen? ( what’s the loop for? )

Thanks for trying to help but this is not what I’m asking about. Those are just falling leaves which don’t react to anything.

Ok, you want to move them again after they’ve fallen.

Possible yes, no idea though, sorry… :-/

you want leave the effect with character motion? you just need to make fore location parameter and link to with character. and what exactly you want o loop here? if the whole fx then loop behaviour will work.

Let me show you what I want to achieve: 2021 04 22 10 18 20 - YouTube

As you can see the player is affecting the leaves on the ground. BUT I want them to be affected by all of the characters (for example enemies) that’s why I’m passing arrays of velocities and locations (Niagara support arrays) BUT can’t find any for loop mechanics that will do my math for each vector.

did you ever find out a way to do this?


You cand make the particle spawn a certain ammount of leaves with collision enabled, and turn off the “kill particles when life has elapsed” option under the particle state tab, and meake the mesh to have physics when the player touches them

Hope this helps!