Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

KappaMic

HELP!! HOW TO MOVE AN OBJECT!! NEWBIE HERE!!!

This topic is 6495 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i''m a newbie... so.... I''ve a little problem, I''m working around a tut (the rotating quad) and i want that after 10 rotation (i can count them), the cube will move to the right of 10 pixels (countinuing it''s rotations). How can i do this??? Please help me. Many thanks!!!!

Share this post


Link to post
Share on other sites
Advertisement

int count = 0;

while(!done)
{
count++;
if(count >= 10)
glTranslatef(10, 0, 0); // Move

glRotatef(rot, 1, 1, 1);
DrawCube();
}


That''s a pretty simple example, it should do what you want. If you replace the 10 with a variable, you can make it continually move. This code will just rotate the cube on all axis and then move to the right 10 and rotate in that position.

Ben

Share this post


Link to post
Share on other sites
I don''t quite nderstand what you mean, but if you put the glRotatef before the if() statement, it may do what you want.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
No matter what you do like that your object will be rotating with respect to 0,0,0.. So you must

Push your current matrix to the stack
build your object (which will be created at the origin
//Next two can be done in any order
rotate it
translate it
pop the matrix


Done..

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!