- Home /
correct waypoint system?
Hey, guys,
I have a Railroad Kit system that I can build at runtime. Currently with a track for straight and curves. Each track contains waypoints, but if I rotate the track (always 90°), the waypoints also rotate and change the order. So the track can't follow the right waypoints. Does anyone have an idea how I can solve this?
how can change the order when rotating? can explain a little bit more? post some code/screenshots?
In this situation, the order after a 90° rotation is no longer correct for the rest of the track.
Answer by tormentoarmagedoom · May 23, 2019 at 10:38 AM
Ok, i See now.
But you have the same problem if rotate a straight rail.
Simple solution: You have 8 curves stored (4 clockwise and 4 counter clockwise) And knowing what was the last waypont of last track you can know if need the clokwise or counter clkwise curve.
Bye!
All right, I've improved your solution. Each track has a start and end point. I let the rail rotate 4 times in the Y-axis until the position of the start and end is the same. If not, it will be mirrored, i.e. 180° in the X-axis and then rotated again 4 times in the Y-axis. In one of these cases the desired case is always included.
That works. =D