# How can I find two points on a spline where the distance between those two points is always a set parameter?

I want to do a game with trains and at the moment ive got some models, some logic behind the placement of the “train body” between the two “axles” or train bogies.

The train is moving along a spline. My problem is that the distance between the two axles always has to be a set parameter (the relative Distance to their parent → the train body).

That means i can’t just pick the location at distance along spline and another location at distance - x. Because, like in the shown szenario the length of the spline track would be much longer than the relative distance of the two axles to each other. I just do not know how I could work around this issue…

At the moment a “railPosition” paramenter moves along the splineTrack, which is in the middle of my actor. And the Bogies/Axles just get placed at a distance +/- 400 along the spline, so i could easily make the train movable.

The system works perfectly fine on a straight but when you get to curves the system makes the bogies/axles move away from each other etc.

Hope someone knows a possible solution to this One solution would be to “bruteforce” the right point on the spline but I can’t imagine that this would be a wise option.

Hi,

There’s a good discussion about this in the post below - the physics based ones look pretty good…