# Orientation while rotating around a point

I am using this formula to rotate around a point.

X := originX + sin(angle)*Size;
Y := originY + cos(angle)*Size;


In cartesian cordinates how would I keep the objects orientation in relation to the origin object as it moves around the origin. Any one know where I could look for answer to that?

• I am sorry I think I have found my own answer I just plugged in to rotate at the same rate locally as I am globally for the sattelites if that makes any sense. So if my angle = 3.6 here than X := originX + sin(angle)*Size; Y := originY + cos(angle)*Size; Than I just needed to this.rotate(3.6); And all seemed fine. – Ray_Garner Dec 10 '11 at 2:43
• "In relation to __ as it moves" I think you missed something there. But yeah, the code you showed takes care of the position, and the only thing missing is actually rotating the sprite by the same amount (angle). – David Gouveia Dec 10 '11 at 2:45
• Please answer your own question and accept the answer so that it is complete; or if you feel it wasn't that interesting, you can delete it. Also, as david says, there is probably a word missing in the last paragraph. – sam hocevar Dec 10 '11 at 12:04

## 1 Answer

I am sorry I think I have found my own answer I just plugged in to

rotate at the same rate locally as I am globally for the sattelites if that makes any

sense. So if my angle = 3.6 here than

X := originX + sin(angle)*Size;
Y := originY + cos(angle)*Size;


Than I just needed to

this.rotate(3.6);


So you just rotate on the satellite objects at the same rate as the local object and that will keep your satellites facing the same direction as when the rotation started.

• And that's why we always see the same face of the moon ;) – kaoD Dec 11 '11 at 13:34
• haha good point !! – Ray_Garner Dec 14 '11 at 13:14