How to change the path that a moving polygon takes and how to give the polygon the appearance of rotating as it moves?

Hello everyone, I am making a graph of a roller coaster that looks like a sine graph. I am trying to make the boxcar follow the path of the tracks and keep going around the tracks in a constant loop. I already got the first part with the straight track at the bottom as you can see from the picture, and to do this I graphed the points of each polygon of the boxcar and I made it so that the x-coordinate was subtracted by t (t was the time from a timer I have in desmos) and the y-coordinate was increased by the slope of the path.

However I am having trouble making the boxcar move up the following tracks and follow their path. I tried to do a piecewise function at first so that the value subtracted from the x-coordinate and added to the y-coordinate at the beginning would only apply for the first few seconds, and then when t was greater than some number then a different value would be added/subtracted from the coordinates. For this I made each polygon’s points different letters, like (A,B), (C,D), etc and I made A equal a certain function until t was a certain value and then I made it equal another function, and the same for the other points. However this didn’t work and it said “Too many variables, I don’t know what to do with this”. Is there any other way I can get the boxcar to follow the tracks?

Also, I am trying to get the boxcar to rotate near the “y-axis” I drew on my roller coaster since at the top of that y-axis, which is the first peak in the roller coaster, the bottom of the boxcar is supposed to be visible with wheels, etc, and when it does down from the peak then the top will be visible, then it will go up the next hill and the bottom will be visible again and so on. But to do this I need to get the boxcar to look like it’s rotating as it goes up the track near the y-axis, so I need to make it go from the top being visible (near the bottom), to the sides (in the middle), to the bottom being visible (near the top of the track near the y-axis). How should I do this?

Thank you for any help!

Hello, welcome!
Are you talking about Desmos 3D?
Do you have a link to share so that we can better understand the situation?

Sorry, it didn’t let me send the link so I just send the last portion, please just attach that to the regular link with desmos/calculator

Thanks for the reply! It’s not 3d desmos, it’s normal desmos but it just looks 3d because of the way I made the shadows. Here’s the link, let me know if it doesn’t work!

/dxntqf7npl

So, this is your creation:
https://www.desmos.com/calculator/nw3rbzhc4p

First of all, congratulations!!! How on earth did you create all those polygons and curves!!!

Second: there are some missing steps if you want the roller coaster to follow the tracks.

  1. You should define two piecewise curves that represent the 2 tracks that the trains will follow. So you should have a point on each track that moves with t and makes a complete loop.
  2. You could now define the base of each cart using 4 points that move on the tracks.
  3. Using the base of the cart you then have to simulate 3D geometry to calculate where to place the walls of the carts.

So basically you need to define everything using the parametric points that move on the tracks. (The other possibilty woud be to define everything in 3D and then apply some 3D rotations and translations).

This is just to give a rough idea of what I think the structure should be:
https://www.desmos.com/calculator/n8pdj8jekg

and yes there are many things that can be improved in my graph …

ps: with people:
https://www.desmos.com/calculator/wkr5chw9z9

Thank you so much! This cleared up a lot of my confusion