# Positioning a collection of objects along a curve

Is it possible to automatically position a collection of objects along a curve? For example, I have 100 cubes (all are different) and want to distribute them evenly along a Bezier Curve.

I searched for a way to do that, but only found how to use Array and Curve modifiers to repeat one object along a curve. This is not what I'm looking for since in my case all the objects already exists.

• Which Blender version, and are your objects already neatly spaced out in a row, or are they all positioned at the origin? Nov 19, 2019 at 22:23
• Blender 2.8. The objects are all positioned at the origin. Nov 19, 2019 at 23:19
• Use a particle system with a collection blender.stackexchange.com/questions/113973/… Nov 19, 2019 at 23:55
• You can order particles,too. But if all are variations on a cube, there may be alternatives, depending on your exact needs? Nov 20, 2019 at 6:43

Even though I was able to get it to work with a particle system, it was pretty fiddly, so I think I have a better solution using a little scripting one-liner.

Make a backup of your blend file, in case something goes wrong.

Then, assuming your cubes are in a single collection called "Cubes", switch to the Scripting workspace and enter the following one-liner into the Python console:

>>> for n,o in enumerate(bpy.data.collections["Cubes"].objects): o.location.x = n*3
... # <Press Enter> #
>>>


The "3" here spaces the objects 3 meters apart along the x axis. Use whatever spacing is convenient to keep the objects separated. We'll adjust the final spacing later.

Now, we're going to create a mesh grid at the origin to control the cubes. Switch back to the Layout workspace, and feel free to hide or unhide the Cubes collection as necessary.

• At the origin, add a Grid mesh with a number of X subdivisions equal to the number of objects (say X=100) and Y=3 subdivisions.
• In edit mode, select the whole grid, and "g x 1 " so the left hand edge starts at the origin.
• In object mode, scale it up so the X subdivisions line up with the individual cubes in the collection. The easiest way is: "s x 1.5 " to scale it from 2 to 3 meters (to match the spacing in the Python one-liner, and then "s x 99 " where 99 is one less than the number of cubes. Double check that all the X subdivisions are in the centers of the cubes. Also, scale it down in the Y direction so the edges of the grid lie within the cubes.
• Now, VERY IMPORTANT -- Ctrl-A Apply the Scale on the grid.
• Back in edit mode, Alt-select the middle Y subdivision edge loop and move it along the X axis slightly.

The idea is to have a triangle of points contained within each cube. It should look like this:

Now, back in object mode, select all the cubes, Shift-select the grid, and Ctrl-P Parent to Vertex Triangle. Each cube will be parented to the triangle of three points it's closest to which will control its position and orientation. Now, you can adjust the spacing by selecting the whole grid in edit mode and scaling it from the world origin pivot. (Note, scale in all dimensions, not just along the X axis, or the cubes will tend to twist.)

Finally, you can tie the grid to the curve in the usual manner. The most reliable method seems to be:

• Select your curve, and Shift-S Cursor to Selected
• Select your grid, and Shift-S Selection to Cursor
• Select grid, then shift-select curve, and Ctrl-P Parent -> Follow Path

Now, the curve can be moved, rotated, and scaled in object mode, and the grid w/ cubes will follow along (in particular, the cubes will scale with the curve, so don't do per-axis scaling in object mode). In edit mode, the curve can be scaled without changing the size of the cubes (they'll slide along the curve to maintain spacing). To readjust the cube spacing (also without adjusting cube size), size the grid in edit mode. You may find it helpful to turn on the Edit Mode Display for the Curve modifier in the modifier tab.

Finally, if the cubes start to twist, note that you can edit the grid and pull just one of the three Y subdivisions forward or back to untwist them. Don't forget to turn off rendering of the grid or give it a transparent material or something.

Here's a 2.80 blend file that shows an example with 100 colored cubes.

• Thank you for such a thorough explanation! I really enjoyed following all the steps. It works. I wonder if this could be done in a more efficient way though. What if the number of cubes has to be changed or animated? Do we have to modify the grid mesh? Nov 20, 2019 at 18:39

I Think one way is to create a particle system from your curve object, then group all instances objects (your 100 cubes) in a new collection, last calls the collection from the render option panel in your particle system as instances (collection not single object).Finally play with the settings.If you need an advanced tool to do that try Animation Nodes addon, there are some video tutorials on instanced objects around.

• Actually, I already use Animation Nodes, so it would be the best solution. Do you have a particular video tutorial in mind? Nov 19, 2019 at 23:18
• it's strange, if you use AN you should know how to instance objects, anyway in the start page of the manual there are the names of the best tutorials creators,Jimmy Gunawan (@blendersushi) has good tutorials also for Sverchok addon.Link animation-nodes-manual.readthedocs.io/en/latest
– mike
Nov 20, 2019 at 2:34