create path for path2d using rails as part of a track.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Timofey

I want to create a game about a railway road, there will be different types of rails on which the train will ride. Each rail is part of a track. I need rails that would be close to the other end of the rails to be magnetized and create a path. As a result, so that you can create a closed path.

what part of this task is blocking you?
path2d curve is fairly easy to fill with new points using add_points(), you can add a new point each time a new “piece” of track is laid down.

and for the “magnetized” part: for each piece of the track you could specify some points around them to use as snapping point, when a new piece of track is close enough to one of this points, you could move it using a Tween (and you could link the tween completed signal to the add_points())

Andrea | 2021-03-09 18:14