Problem with railroad track alignment on spline

Hi,

I am busy trying to create a spline based railroad track.
Although is is almost working perfect, there is a small issue I cant get rid of. :frowning:

The problem is that the tracks to not always align with the clamps on the track.

Maybe someone has an idea on how to address this…:confused:

Here is the setup:

The clamp mesh:

And the track mesh:

b483f347f7a4a595c592bd0f29031cc4013378bc.jpeg

The track is constructed in two passes.
First, the bar elements are laid out, then the tracks are added.

The bars are placed equidistant according to the BarSpacing variable, which is exposed.

The tracks elements are placed as spline meshes almost in the same manner. The length of each spline mesh segment is set by the TrackLength variable, which is also public.

On a straight track, it works perfectly, but when it gets curvy, this happens:

editor1.JPG

Look almost right, right?
However, this is a closer view from the other side:

As you can see, the tracks do not follow the clamps in curves…

When the bar spacing is drastically reduced, the misalignment is showing quite nicely:

cbe1a2e0ab54810f0c571c0cc1714398a36a6ca4.jpeg

Am I missing something here that could be done to make the tracks follow the clamp better?
Is there something wrong with my component rotations?

Any help is appreciated :smiley:

Cheers,
Klaus

Did you ever figure out what was wrong here?

Yes and no :slight_smile:
It finally occured to me that two parallel splines do not have the same curve radii. So the left track is not a parallel shifted copy of the right one.
I thought I could get away with that but I didnt want to deal with spline tangent math, so I simply changed the mesh to include a bar and a piece of rail, then one spline is enough.