[Solved] One-way monorail sim - Make use of several Path2d and best approach to the matter

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Giovanni “Johnny” Co

Hello and thank you in advance to anyone who will share his/her opinion.
I would like to simulate a one way monorail system as per the below schematics.
My approach would be to define 9 path2ds and then - using a reparenting of the Pathfollow2d - I would move the vehicle from the current path to the one connecting to the desired arrival Station.

At the moment I have only set up 2 paths and I am only able to move a vehicle from Station A path2d 2 to the Main track path2d 1 via reparenting.
I can not figure out - as an example - how to instruct the vehicle to move from the Main track path2d 1 to the arrival exit track (e.g. Station C path2d 5).
In the final project I would like to have a setup as the above picture and a simple GUi, as per the below picture:

I would love to read your suggestions on the following topics:

  1. How would you approach the matter of coding - in Godot - the described system.
  2. If you agree on using multiple 2dPaths and how you would tackle the “exit at Station X” issue
  3. In which way is created - in Godot - a “Station” Object, e.g. an object which stores each station information (name, number of available vehicles currently at the station) and a “Vehicle” Object, e.g. an object which stores each vehicle information (vehicle id, current path, current station, current x, current y).

Thank you for reading, any comment will be highly appreciated.


The reddit user Arigoru posted his approach to the question here: reddit link alongside a demo video.
Thank you Arigoru!

Giovanni “Johnny” Co | 2020-02-08 22:45