Announcement

Collapse
No announcement yet.

Problem with railroad track alignment on spline

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    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...

    Here is the setup:

    The clamp mesh:

    Click image for larger version

Name:	clampmesh.JPG
Views:	1
Size:	39.7 KB
ID:	1176094

    And the track mesh:

    Click image for larger version

Name:	trackmesh.JPG
Views:	1
Size:	38.9 KB
ID:	1176095

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

    Click image for larger version

Name:	construction.JPG
Views:	1
Size:	47.5 KB
ID:	1176096

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

    Click image for larger version

Name:	createbars1.JPG
Views:	1
Size:	113.8 KB
ID:	1176097

    Click image for larger version

Name:	createbars2.JPG
Views:	1
Size:	116.5 KB
ID:	1176098

    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.

    Click image for larger version

Name:	createtrack1.JPG
Views:	1
Size:	58.6 KB
ID:	1176099

    Click image for larger version

Name:	createtrack2.JPG
Views:	1
Size:	194.4 KB
ID:	1176100

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

    Click image for larger version

Name:	editor1.JPG
Views:	2
Size:	27.4 KB
ID:	1176101

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

    Click image for larger version

Name:	editor2.JPG
Views:	1
Size:	35.6 KB
ID:	1176102

    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:

    Click image for larger version

Name:	editor3.JPG
Views:	1
Size:	72.3 KB
ID:	1176103

    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

    Cheers,
    Klaus

    #2
    Did you ever figure out what was wrong here?

    Comment


      #3
      Yes and no
      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.

      Comment

      Working...
      X