Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spline Spots from 2 samples.
#1
Hi! Just started using Curvy Splines. So far it's quite remarkable, I can tell I have a lot to learn.

My game revolves around building railroad tracks from pieces. I'm building out the "blueprint" mechanism that directs the player where to put the rail. I'm using a basic generator to compute points on the curve to create the "place here" objects.

It works like a charm for the sleepers the the rail segments are in interesting case. The single point sample on the curve at the rail interval doesn't pick the most intuitive position and rotation for the rail.

Accepting that the inner/outer radius will create overlap and gaps, the placement (centered on the green line) is the aesthetic preference such that the ends of the rails approximately line up. When sampling a single point the tangent will not capture local region curvature.
   

I can of course manually nudge them into an approximate preferred position but I know the spline knows the end points, I'm hoping for some Curvy Spline advice that will help me realize how to position and rotate these rail segments. The endpoints also seem like a challenge.

   

Thanks!
Reply
#2
Hi,
Is having straight rail sections (vs curved ones) a deliberate choice? If not, using the Deform Mesh would solve the raised issue.
If using Deform Mesh is not what you want, please send me you send and related assets so I can see how you did setup it.
Thank you.
Please consider leaving a review for Curvy Splines, this helps immensely. Thank you.
Reply
#3
(06-19-2026, 11:18 PM)_Aka_ Wrote: Hi,
Is having straight rail sections (vs curved ones) a deliberate choice? If not, using the Deform Mesh would solve the raised issue.
If using Deform Mesh is not what you want, please send me you send and related assets so I can see how you did setup it.
Thank you.

Thanks for responding so quickly! Yes the straight rails are a deliberate choice. The point of the game is to drag physics objects into place, the player is given a straight rail piece and needs to position it. The game doesn't necessarily needs to support arbitrary curves, just a few moderate turn outs that are mapped to grid points.

The player's actions will lead to a deformed mesh over the spline as we'd expect for a track, the experience is to build the track one piece at a time.

I can send you a project export however my prototype is deeply intermixed with other store assets I cannot distribute. Please allow me a day to reconstruct the scenario in a shareable setup. In case it's sufficient, I have attached a screenshot of my generator setup. I only started working with Curvy Splines this afternoon, please forgive me if I've done something foolish.

Thanks!

   
Reply
#4
You done nothing foolish, don't worry.

Here is a screenshot of two different generators:
   
The top one is made similarly to yours (using Path Relative Translation module). The bottom one does not use that module, but sets the translation in Volume Spots module -> Group -> Translation -> Translation X (with Relative Translation set to true). The bottom one produces the result you want I believe.

Basically what is happening in your setup is that you generate two different paths, with different lengths, and placing objects in both paths with the same inter-object distance will eventually lead to the right and left objects not being aligned anymore.

With my solution, every left/right object couple is placed at the same position spline wise, but with an additional translation.
   
Please consider leaving a review for Curvy Splines, this helps immensely. Thank you.
Reply
#5
The local translation is indeed an improvement however it still misses the spline alignment aspect I wish to solve. I have hidden most of the clutter to hopefully illustrate the case better.

The S-Bend is particularly disjointed.
   

Moving the objects by hand, I can make the ends of the segments lie on the line with the center point off the line.
   

My intuition is that there are probably a couple ways to do it, but they all involve more than one sample point per segment. 
   

This is also why I say the end seems like a problem.

   

I'm considering it may be better if the segment origins were at the beginning and a look rotation could be formed from the next interval point.

Thanks for working with me on this!
Reply
#6
Apologies, quick follow up. I realized my example misrepresents the placement. I initially said that overlaps and gaps are expected since the rail segments are offset from the same center spline. Noting that the spline distance will differ from the linear distance between segments. 

Expectations given a pretty harsh curvature.
   

The red dots are the spots computed as you suggested, a relative translation off the spline. The green circles are computed in the same way only offset by half the distance between the red points.

From there, the rail segment origins line on the red line formed from the center tangent and are aligned to lie on the line that would be formed from the two green circles before and after the red center position.

I believe I have a conceptual solution, I'm not just not sure how best to articulate it using Curvy Splines.

Thanks again.
Reply
#7
I see. I think it is best not use, at least as a first step, the Curvy Generator for this. I suggest to make a script that computes the positions of P1 and P2, and then use them to define the orientation and position of each object. You can do this by using the CurvySpline methods (such as InterpolateByDistance).
Like you said, spline distance will differ from the linear distance. I am sure there is some math to do the equivalence, but for doing a search of the linear distance around the value of the spline distance (by sampling multiple points until reaching the one at the right linear distance) should to be too expensive. It could be a quick to implement solution.

One you have this solution, and if you see a need for it, you can translate that logic into a CGModule.

This is how I would have gone with it.
I hope this helped.
Please consider leaving a review for Curvy Splines, this helps immensely. Thank you.
Reply
#8
It does! Thank you very much. I will begin researching how write custom object creation that responds to the Curvy Spline lifecycle.
Reply
#9
You are welcome. Feel free to ask questions here. I am on vacation, so I will not answer as quickly as usual, but I check the forum from time to time.
Please consider leaving a review for Curvy Splines, this helps immensely. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Best way to duplicate a spline with an offset Kapistijn 8 1,939 04-12-2026, 03:18 PM
Last Post: _Aka_
Smile Constant speed along a spline? tfishell 1 840 11-13-2025, 11:32 AM
Last Post: _Aka_
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 4,825 07-29-2025, 09:15 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 7 6,707 07-13-2025, 07:11 PM
Last Post: _Aka_

Forum Jump: