PDA

View Full Version : rotating and translating



gleps
08-22-2010, 09:52 PM
I have a landscape with a ship on top. The ship stays in the same position on the screen, and the land underneath moves to make it the ship is moving and turning. If I code translate first, the translation will move in the correct direction(left will move the image left), but the rotation will rotate from the same point(corner of the map). On the other hand, if I put rotate before translate in the code, the rotation works correctly, but the translate does not (left will move the map from the ORIGINAL left, where it started before rotations, appearing to move right, or forward depending on where it is rotated.

Only way I can see to correct this is by using trig functions to calculate the translation based of the current rotation. Is there a better way to work this that I'm not seeing?