I am currently working on a train track creator tool for my game, and I’m looking for the best approach to achieve this. I would like the player to be able to select point 1 (indicated by the red brick) and point 2 (indicated by the blue brick) with their mouse (the points may not be snapped to a grid). I need a way to create a slight curve between the two points and then fill it with train tracks that are 1-12 studs long.
I don’t have the exact solution for you, but I would highly recommend that you take a look at Bézier curve. I have never experimented with them before, but from what I understand, you should be able to make a curved path and check if any angles are too strong for a train to pass on it.
Thank you, I will try some experimenting with Bézier Curves, I will mark your reply as a solution and if I have more questions I will simply reply again. Thanks.
I would highly suggest that you use them as follows:
P0: Starting point
P3: Ending point
P1: A point that is right in front of P0 and that has half of the distance from it as P0 and P3 have,
P2: Same thing, a point that is as far as half of the distance between start and end AND that is in front of P3.