Hey! I am making a simulation for my calc 1 professor. He wants a simulation of a ferris wheel where I can check the positions of the passengers on the Y axis at different points in time during the rotations. What I need help with is how to arrange ferris wheel cabins (just a simple ellipse) in a circular pattern around the ferris wheels hub, and how to change their x and y positions to make them rotate manually.
I looked into just using rotations but it seems like if I use the translate and rotate methods I won’t be able to store and view the x and y positions of the cabins. I need to be able to do this freely to have the simulation have any worth.
Anybody know how to do this or can point me to a tutorial?
The ferris wheel
It has a center point. Store that in a var (using createVector maybe).
It also has a radius. Another var.
Cabins
Each cabin has a rotation or angle property, describing its position on the circle.
And probably a passenger count.
There are a number of cabins, so probably they are represented by an array of objects.
With the above, the position of each cabin can be described as:
x: ferris wheel center X + Math.cos(angle of cabin in radians) * radius of ferris wheel
y: ferris wheel center Y + Math.sin(angle of cabin in radians) * radius of ferris wheel
(OTTOMH, but I think I made no typos )
(edit)
of course you need to change/increment the angle of each cabin every draw call so that they rotate around the hub.