Jump to content
  • Advertisement
Sign in to follow this  

3d Local Axis Rotation Problem

This topic is 3566 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 have a 3d rotation problem that really shows up my lack of 3d knowledge lol. I'm trying to move a camera around using the arrow keys. Left-right arrow is supposed to rotate about local camera z axis, and up-down around local x-axis. But this code seems to rotate around the origin. Is it something to do with the order of operations? Any help greatly appreciated. //===================================================== SwitchTo3D(WINDOW_WIDTH, WINDOW_HEIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /// Load ship Position Matrix (camera) XFORM3D m; XForm3D_SetIdentity(&m); XForm3D_RotateZLocal(&m, Float_DegToRad(AngleZ)); XForm3D_RotateXLocal(&m, Float_DegToRad(AngleX)); XForm3D_SetTranslation(&m, Pos.x, Pos.y, Pos.z); glLoadMatrixf((GLfloat *)&m); DrawPlanet(Pos); //=====================================================

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.

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!