Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I need to rotate an image in opengles GLkit and get it back to its original position in GLkit.

rotation += 5;
_modelViewMatrix = GLKMatrix4Rotate( _modelViewMatrix, GLKMathDegreesToRadians(5), 1, 0, 0);
_modelViewMatrix = GLKMatrix4Rotate( _modelViewMatrix, GLKMathDegreesToRadians(rotation), 1,0,0);

I need to move it in x axis for certain amount and getting back to its original position from where it started. How should i do it?

share|improve this question
Interpolation/tweening will be your friend. Save your start rotation and position as well as time, maintain a percentage variable and increase it to 1 for so many seconds, then back to 0. Multiply the distance you want to move in total by this percentage and add that onto your original start positions/rotation (you'll probably want to have two separate end variables, one for x-axis and one for the rotation since you probably don't want to be moving x as fast as you rotate or vice versa). – Jeff Mar 15 at 12:53

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.