
Instead of plotting the box's path with complicated trigonometry equations I don't know, using a finicky physics simulation to stay on track, or using costly raycasts to read the rails every frame; this rectangle is simply animating along a local motion path. When the end of a path is reached, the "train" looks ahead to see where the next track section is, centers itself on the new section, and starts a local animation clip (either straight right or left depending on the type of track). If all goes right, the moment it jumps to the new track section should be unnoticeable. It then animates along that path until the end is reached and the process repeats. Let me see if I can illustrate this idea. I know words probably won't do it...
Cars will loop their animation locally if there is no next track section...
...if there is, however, the car moves and re-orients itself to the next track section before re-playing the animation. The jump is too fast for the player to see (here, I have made it visible with the green indicator), and the motion of the car looks seamless.
16 hours in.


No comments:
Post a Comment