i;m trying to use animation nodes for the first time. I've made a sub program which does what it's supposed to (scale objects up as a sweeper object goes past them in the X axis) , but How can i make it do this for all objects in a collection instead of having to put an object input for each object i want to affect?

Something like " for each object in Collection, set it as input for Subprogram"

I have hundreds or maybe thousands of objects i want this to apply to so its really not practical to add them all one by one. My current setup


1 Answer 1


Use a Loop Subprogram to do "for each something in somehing":

enter image description here

  • $\begingroup$ A huge amount of thanks, that worked perfectly, i just "changed objects from group" to "collection Info" because i'm in 2.8 and it doesn't seem to have groups here. $\endgroup$ Feb 14, 2019 at 22:59
  • $\begingroup$ Hi, hopefully this question and answer is still live because i'm really struggling with the answer! I have tried every way possible to pass the Collection list length into the subprogram - how do you get the 'Iterations' input on the Invoke Subprogram node? Without it, i can't see how you get the loop to address each object in the Collection. Any help will save my sanity . . . .!! $\endgroup$ May 29, 2020 at 16:42
  • 1
    $\begingroup$ @StephenSamuels add Invoke Subprogram node, click New Subprogram and choose type: Loop. The node should have the iterations input. Then you go to the subprogram node and add a new parametre of type Object Group. If this does not work, what version of AN are you using? $\endgroup$ May 29, 2020 at 21:56
  • $\begingroup$ @JaroslavJerrynoNovotny I've been messing around with animation nodes for about 2 years and that's the first time i've understood how to achieve an iteration input! (i could have saved myself a lot of hair tearing if i'd asked sooner!). What i have been doing is adding a loop node, defining the iterators and parameters and then creating an invoke node. This then comes with inputs to match the loop node - an iteration input therefore missing. By creating loop and invoke nodes together - before defining inputs - gets me precisely where i wanted to be. Thank you Jaroslav, you've done it! $\endgroup$ May 30, 2020 at 9:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .