Hello! If this question is already answered tell me.

So I noticed when you use sin and cos to make an object rotate around another,the closest object seems to rotate slower than the object farthest. Why does this happen? How can I make the farthest have the slowest speed and the nearest the fastest?@OMTL(sorry if you didn’t want to get tagged.)

@Thinbuffalo,@William04gamerA,@Stradyvarious,@Petrichor,

Can you guys help?

# A question about rotating around a object

**Aariv**#1

**ThinBuffalo**#5

Hi @Aariv what you’ve noticed is the difference between rotational velocity & linear velocity.

I’ll explain this better a bit later in the day when I have more time, but when 2 objects turn at the same rate (rotational velocity), the one making the larger circle will be moving faster (linear velocity). It moves faster because the *circumference* of the larger circle is greater.

**ThinBuffalo**#7

Hi again @Aariv

Here’s an example of what I think you’re trying to do:

https://c.gethopscotch.com/p/zlr3i8lgs

In the example both orbiting “planets” travel at the same linear or tangential speed. That means that even though their respective circles are different diameters, they’re moving at the same Arc Length per frame. Arc Length per frame is a linear speed that’s analogous to meters per second (m/s) as opposed to revolutions per second (RPM) which is a rotational speed.

This is relatively easy to do with a little math. Here’s how:

C = 2πR

where,

C is circumference

R is radius

π is pi (~3.14)

S = C(θ/360)

where,

S is arc length

θ is angle (the angular change per frame)

Then solving for θ

θ = 360S/(2πR)

In the example project I refer to θ as “Rotational Speed”.

Then we use this by incrementing the “Rotational Position” by the “Rotational Speed” every frame (in a When 7=7 block)

Also every frame we reposition the rotating objects using the cosine and sine formulas.

X Position formula:

(Radius * Cosine(Rotational_Position)) + X_position_of _center

Y Position formula:

(Radius * Sine(Rotational_Position)) + Y_position_of _center

And that’s it (this should make more sense if you look at the code in the example project)