Today I come to you with a sort of math/programming problem. I have a rotating set of gears. These gears have rope going between them. The problem is, the aesthetic of the game is “blocky”, so the gears are blocks, as are the ropes. The gears must turn and the ropes must look like they properly reach the gears. As you can see below, the blue points are the ‘points of impact’ the rope has with the gear. The gear has rope rapped all the way around it. As the gears turn, the script must be able to calculate where the new ‘blue points’ are for each frame of this turning movement.
The turning movement must always maintain the same speed, so the calculations must take into account the time between each rendered frame. This is to ensure speed over smoothness.
The depiction below shows how the blue rope impact points might move as the gears turn. The red ropes between the two gears would adjust size and position to reach the proper position on the gears. I imagine that when a certain point is reached, like the rope would appear ‘flushed’ with the top or bottom of one of the gears, the blue point would instantly jump to the next corner. I’m not sure if that makes sense, but I’ll do my best to explain further if requested. I also imagine having these gears be out of sync with one another would look really awkward when it comes to the ropes, so I’ll have the script set the gears to face each other directly upon server start.
Here is an animated gif of what I’m after. You can see that the orange ropes are the parts that move and they stay relatively the same size and orientation. They move to touch the white ‘impact points’ at the corner of each yellow gear. When the gear reaches a flat level where the orange rope is flushed or flat with the gear, the white ‘impact point’ teleports to the next corner in succession. This would be the upcoming corner for the top rope and the going away corner for the bottom rope. The cycle repeats, and the player sees a rope simply winding around 2 gears.
Thanks for the input! Simply rotating the gear 90 degrees backwards every time might not have the intended effect, since the sides of the gears are wooden so you’d see the wood grain being reset every turn.
I’d also prefer to use parts if possible. It seems I may be able to make invisible reference points which rotate separately from the gear but at the same speed, and while the gear turns normally the invisible reference points would reset every 90 degrees
Using parts would definitely be harder, not necessarily positioning the belt parts, but making sure their angles line up with other parts of the belt already wrapped around the gear.