Reordering Collection of Objects by their average coordinate?

Hi,

I have a path curve and a collection of objects (they are also curves but it is not important). In geometry nodes I want to create an instance of every object in the collection along my path. This is simple: i resample the path curve with the correct number of points and then use instance on points node.
Now here is my problem. The objects in the Collection Info are ordered according to their name: if i have objects A, B, C, then A will be on the first point, B on the second and C the last.
If i want to add another object i should rename some or all the objects.
I would like that the objects are ordered according on their z-coordinate, so that if object C is the one with the smallest Z coordinate it will be on the first point for the Instances of Points node. Is it possible to do something like this using geometry nodes?

Hello, this should be simple task:
blender_afWZThPb5A
sort.blend (678.5 KB)

4 Likes

Thanks, you are a life safer. I was trying to do it using accumulate fields for the z coor on all the mesh points and it was a mess. I really have to get better working with instances.

1 Like