Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
    
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
1  
"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
1  
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
    
Ok thanks I edited it. –  Ray_Garner Dec 11 '11 at 3:15
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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