Jump to content
  • Advertisement


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


Need help with a rotation function!!

This topic is 6116 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

I am working on a project for my graphics class using GLUT, but this is a general question that is non-language-specific. I am putting all my objects into classes, so that I can use inheritance to propagate object creation. My problem is that I want to make an easy way to rotate the objects. Using three variables (pitch, roll, and yaw) seems the easiest way, but I don''t know of an easy way to make it work. Doing the rotations seperately in sequence has unwanted results, because of the coordinate change with each rotation. Can this be done with a single matrix multiplication of some kind? I read on one of Nasa''s pages that this was computed for the shuttle using a single Eigen axis rotation, but I haven''t the slightest clue as to how to make that work. I just want something that is halfway intuitive to use to rotate the objects and that I can reset easily. Any help would be greatly appeciated!! >^,,^<

Share this post

Link to post
Share on other sites
The quaterion looks like the way to go, but I am just too slow tonight to figure out how to convert:

m_pitch = 5.0
m_roll = 40.0
m_yaw = -10.0

into something like:


Share this post

Link to post
Share on other sites
The storage is used to keep record of all the rotations. Using the code you provided will result in some side effects that I am trying to avoid. For example, if m_Roll is 90, then the Y-axis has effectively become the X-axis, and the new Y-axis is the old negative X-axis. Any rotations after this (like the m_Pitch and m_Yaw) will be wrong, or at least not what I want. I want all the rotations to be independant of order or each other. Thank you for your help though!

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!