oneFoolsArmy
Simple Version: Is there a way to shuffle the contents of a vector array? I want each vector to be preserved, just have all the index numbers shuffled.

Long Version: I have a piece of geometry I'm using to position nParticles. 

geometry.worldMesh > bound SOuP > pointSOuP > arrayToDynamicArray SOuP > nParticleShape

I'm animating my particles through goalWeightPP expressions which act in sequence based on particleID. Everything works perfectly, can't say enough good things about SOuP! However, the particles are positioned in order so my animation runs strictly in an ascending pattern along the object. I want to try the effect in a more random fashion and I figured the simplest way to do that would be to shuffle the positionPP array like a deck of cards before it gets to the nParticleShape so the particles were not so strictly ordered by ID in the resulting layout. 

Am I on the right track here, and is this possible? Or, more likely, is there a different or better solution I'm just missing?
     
Reply 0 0
noizfactory
If I've understood you correctly, you just want a random index or id per particle? I've attached a simple file demonstrating the same within the point node. You could do the same in the particle shape node itself. Further, if you just want a random position indexed then you can use this random index to look up the corresponding position from the point position array and feed that into the particle.
Reply 0 0
oneFoolsArmy
Thanks for the example! A quick look would suggest that what I need is in here. I do have a few quick questions about this solution if it's not to much of a burden on your time.

The seed($ID) line will ensure that no random index is repeated at all?

When the time node is connected to point SOuP the weight section will update each frame just like position or rotation? (ask because it has no apply changes check box)

If end up running expression in point SOuP node, than when attaching the outWeightPP to goalWeightPP would you recomend using the arrayMapper node native to maya? Or is there, as I suspect, a SOuP alternative? Direct connection seems invalid as maya is not registering outWeightPP as a proper per-particle attribute it seems.

Thanks again for the help, it is greatly appreciated!
Reply 0 0
noizfactory
seed() will ensure that the rand() returns the same value every time its evaluated.
If you need animated weight per frame then connect the out time of the time node to the time attribute of the point node. Or something like that. I forget the details but a search will pobably bring up previous threads with thi topic. You can also use $F within the seed to change it per frame. $F corresponds to the current time.
You'll have to do a getAttr within the particle shape for your goalPP since direct connection is not possible like you said.
Btw, you can run a similar expression within the particle expression itself instead of the point node if all you need to do is randomize the index and assign that to goalPP.
Reply 0 0
oneFoolsArmy
Thanks again for the knowledge, I'll give it a try. 
Reply 0 0
Reply