Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Timofey |
how to make a railroad where each part of the railroad will be a path that can be connected to the rest and create a closed path
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Timofey |
how to make a railroad where each part of the railroad will be a path that can be connected to the rest and create a closed path
Reply From: | estebanmolca |
path2d uses a 2d curve for the points. I would create the sprites with the different directions of the rail and I would put each sprite as a child position2d at the ends where I want them to connect. Then I would use the path functions to add points to the curve where the position2d in the sprites are. Another more suitable way (although I never use it) is to use tilemap, each tile can be assigned navigation. The tiles can be created ingame and you only have to worry about checking that the tiles to be joined are the correct ones according to the rail check this video:
The first option sounds simple, but how can you close the points through the code in the path?
Timofey | 2021-03-08 16:24