Creating a curved track generator, but ran into the problem of having gaps between the rails

So I have made a script to generate a curved train track (using bezier curves), The issue is that there are gaps in between the rails, or the rails are overlapping

The way to fix this would be to use something like the Resize Align plugin, but obviously this would take a while to do because it involves selecting each part one by one. My idea was to use something similar to Resize Align, but implement it into my script to make it automatic.

If this didn’t make sense, take a look at this image bellow:


Yes, there are gaps between the rails. This also occurs the opposite way on the inner rails as seen bellow:

I would like to know the basic calculation to resize these parts, if there even is any. They need resizing on the Z Axis only.

1 Like

It would be helpful if you provide the source code of your train track generating algorithm

We need a look at the script to define the problem.

I have found the solution to it just now. All I did was resize all of the parts by 0.2 to hopefully fill in the outer gaps.

1 Like

Mark it as solution so that people know it’s solved

i suggest you model several variants of curved rails pair in Blender, say, straight lines, switches, crossings, U-turns, but also curves of various radii, say, 30, 45 and 70 degrees, then import those meshes and combine them on purpose