Moving a group of rotating objects.

207 Views Asked by At

I have some objects that rotate around a common center, the formula I use to calculate their rotation is something like:

Math.cos(angle) * radius; Math.sin(angle) * radius;

in every frame I update their position, and everything works ok.

Now, I need to also move the entire group of elements like if they were attached to something. Think of them as numbers in a wheel of fortune, and the wheel is moving to the right, at a constant speed.

So I have to mathematically calculate how much I should increase the X of each rotating element so they appear to move together as a group of objects.

If I just simply add a static increment after I assign the new position, it ends up having a sort of deformation, the circle is gone. I assume I would need to use he sin, but my tests fail.

Group of rotating elements:

enter image description here

What happens when I add a static amount in the X axis every frame:

enter image description here

1

There are 1 best solutions below

1
On

If you attach radially with length along radius $r,$ no problem. If you have a radial component $c$ as well, then you need to consider $ \sqrt { c^2 + r^2 }$ as new radius.

EDIT 1/2

You superimposed rotary motion ( unintentionally ) with linear motion. Not adding to both $X,Y $ but only adding to $X$ created an imbalanced $ prolate-cycloid $ situation. The static amount should be added for $Y$ also.

The speeds at top and bottom should not be different.They should be made same with same offset of circle center.

prolate cycloid