Jump to content
  • Advertisement
Sign in to follow this  
Hachaso

Rotation of several objects around y-axis

This topic is 3642 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 trying to manage to rotate several object around the same axis. Like they are part of a circle. _____ | | ___ | | | | _ | | | | |_| | | |___| |____| The objects should move around the y axis, always with the image facing the camera. Unfortunately I can't find any good formula for this. Is this done using only glTranslatef(...) ?? Thanks

Share this post


Link to post
Share on other sites
Advertisement
If you create a scenegraph, you can put all your objects into the scene as a child node of a transformation node that you rotate. When you render, just strip out the rotational matrix in your 4x4 modelview matrix to cause each object to face the camera while it moves around the Y axis.

Share this post


Link to post
Share on other sites
Sound wonderful but how do you do this?
Are there any good examples, tutorials to look at?

I have looked here at gamedev but without success.

Please help!

Share this post


Link to post
Share on other sites
I think something like this should work:


glRotatef(angle, 0, 1, 0);
glTranslatef(...);
glRotatef(-angle, 0, 1, 0);


Read this to learn more about how transformations work in OpenGL, especially the section "Thinking About Transformations".

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!