1
\$\begingroup\$

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?

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – Ray_Garner Dec 10 '11 at 2:43
  • 1
    \$\begingroup\$ "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). \$\endgroup\$ – David Gouveia Dec 10 '11 at 2:45
  • 1
    \$\begingroup\$ 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. \$\endgroup\$ – sam hocevar Dec 10 '11 at 12:04
1
\$\begingroup\$

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.