Calculate gears rotation for a realtime simulation
- by nkint
Hi I'm trying to do a game with real time simulations of gears. There is a big Gear with inside a smaller gear.
I managed to draw gears with different diameters but equal size teeth, but if i try to move the smaller one inside the bigger one the movement is odd.
see the animated gif.
the biggest gear is in center C1 and the small in the center C2. I calculate C2 position in this way:
C2.x = C1.x + C1_RADIUS-C2_RADIUS) * cos(t);
C2.y = C1.y - C1_RADIUS-C2_RADIUS) * sin(t);
for t that goes from 0 to TWO_PI in n steps.
I apply as rotation the angle t, but maybe it is wrong and i have to calculate another rotation for get a perfect joint