# Erratic “railway” in Blender

I have a pair of rather complex-looking curves, which are both slightly different. Now I'd like to make a cube array fit between the two curves, think of a railway. However, the tutorials online are for a single curve with railway segments (or similar objects). I'm trying to fit a cube array between two curves.

I tried using the vertex groups on the array, as to map each side-face on one of the curves but this gives crazy results. Can anyone help out?

Single modifier
This is using one curve modifier. As you can see, there's some ends just "floating". Modifier stack:

Array - 45, relative offset
Curve - targeting curve 1, with vertex group 1 (looks identical without the vertex group), along X


Two modifiers:
Now if I add the second modifier, I get all kinds of weird effects (which look fancy but aren't really what I'm trying to achieve; when I change the axis for the 2nd modifier, I just get other, weird looking results): Modifier stack:

Array - 45, relative offset
Curve - targeting curve 1, with vertex group 1, along X
Curve - targeting curve 2, with vertex group 2, along X


It should work. Make sure the origins of both curve objects and your cube or at the exact same location, and that their scale is 1, 1, 1 and rotation is 0, 0, 0.

In edit mode, set one face as a Vertex Group.

Add an Array and 2 Curve modifiers, each one set to a different curve and using either the vertex group or its inverse.

Alternatively, for a slightly different result, instead of using a Cube, merge everything in edit mode until you have a single vertex at the object origin. Then, with the vertex selected, extrude it and right click to cancel the translation. With the second vertex still selected, add a Vertex Group and assign it.

Add an array modifier and a curve set to one of the railings. Add a Shrinkwrap modifier restricted to the vertex group and set to the opposite railing mesh object that you arrayed earlier.

Finish with a Skin modifier to get your elongated cube.

Note the skin adds a lot of geometry. You can plug a Decimate modifier set to planar at the end to remove unnecessary geometry.