Using animation nodes I was able to make a procedural animation of a bridge made up of tiles coming from above and forming said bridge.

I created it by taking a plane, subdividing it 10 times, separating the faces, made them separate objects and added them to a group. I use said group in a loop subprogram for the animation.

The issue arises when the tiles come in, they come in at a weird order. I wanted to know if there is a way to control the order of which the tiles(objects) come in? Is that possible or would I have to connect hundred of objects in the correct order in an object list.

Thank you for your time!

  • $\begingroup$ The question is specific about sorting the order. But I see several ways here, depending on the case. For precision: are the tiles the same or have to be slightly different? Is the grid original order OK or you need another ? (the group is not reliable as order) A pic of the loop or how you animate the positions falling would help too. $\endgroup$ – o.g. Jan 20 '16 at 8:01
  • $\begingroup$ I have not gotten a chance to take some screenshots but will do as soon as I can. As of right now I'd be fine if they were all the same. Grid order is great! but would ultimately like some control ( making it come in from back to front or middle outwards. ) I know a picture is better but I'm using a compose matrix to control the transformations. Using a animate matrix with a time delay to make they come in one at a time. Sorry for the lack of picture but I will get one soon. $\endgroup$ – West Rodri Jan 20 '16 at 18:58

First of all, blender group is not reliable as objects order.

Otherwise, you need a fixed location of objects as a reference for sorting by location. Given that they are moving around you have to consider only the final position (landed) for sorting.

This goes 2 ways:

  • you use instancer to copy same object. Here you need to sort the vectors positions (vector list) that give the location of objects (instances), and not the objects

  • if have a list/group of objects that are different, you have to use id key node (object submenu) to get the initial rot/loc . But first, make sure you set initial transforms (in 3d view, AN panel) for all objects. This is slightly different and I'll not detail here.

I will detail the first case

For the examples below I use the template Grid Arrange.

  1. Just use the grid order This goes naturally if u use the respective template or similar.

enter image description here

  1. Use a distance to object to sort In comparison to above, use a vector/ vector distance node to compare each position to an empty (or something else)

enter image description here

  1. U can further use some expressions U can do the same by sorting the vector (landed positions) first as distance to or as direction as shown in the pics with formula:

distance to:

sorted(list, key = lambda item: (item - point).length_squared, reverse = reversed)


sorted(list, key = lambda item: item.dot(direction), reverse = reversed)

where the inputs are: a vector list, a vector, a boolean

enter image description here

enter image description here

Please note that in all these case I basically sort the vectors, not the objects. For the other case, you would sort the objects based on the list of (id key ) initial locations.

| improve this answer | |
  • $\begingroup$ Hey! o.g. Thank you so much for the detailed and quick answer! This is exactly what I was looking for. I'm getting pretty serious with animation nodes and aim to fully incorporate it with my work flow. I will be asking many more questions in the future. Thank you again for answering! $\endgroup$ – West Rodri Jan 22 '16 at 19:26
  • $\begingroup$ You're welcome. Please do ask more. Ideally, the q would be specific and maybe even illustrated :) $\endgroup$ – o.g. Jan 25 '16 at 3:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.