Archived

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

lowlevel

OpenGL game programming->PlaneView

Recommended Posts

I just bought the book yesterday and I have a question about the example code on page 120. It's a function for placing a "cockpit" in the world. What I find strange about this function is that it does the rotations in the order roll-yaw-pitch. Would that really work? Shouldn't it be yaw-pitch-roll? Here is the code:
    
void PlaneView(GLfloat planeX, GLfloat planeY, GLfloat planeZ,
               GLfloat roll, GLfloat pitch, GLfloat yaw)
{
   glRotatef(roll,  0.0f, 0.0f, 1.0f);
   glRotatef(yaw,   0.0f, 1.0f, 0.0f);
   glRotatef(pitch, 1.0f, 0.0f, 0.0f);

   glTranslatef(-planeX, -planeY, -planeZ);
}
     
Edited by - lowlevel on November 15, 2001 7:15:12 AM Edited by - lowlevel on November 15, 2001 7:15:56 AM

Share this post


Link to post
Share on other sites
This looks fine to me.

If this is your coordinate system...

Y
| /
|/
X---*---
/|
/ |
Z

Then the yaw, pitch and roll are accurate. If you are complaining about their order, well that doesnt really matter. You can do those rotations in any order since they are each on different axis.

Nitzan

-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------

Share this post


Link to post
Share on other sites
Well that ascii drawing sucked. So much for beginnign spaces.
Let me draw it again.

....Y../
....|./.
....|/..
X---*---
.../|...
../.|...
.Z..|...

Share this post


Link to post
Share on other sites