Advertisement

OpenGL game programming->PlaneView

Started by November 15, 2001 06:13 AM
2 comments, last by lowlevel 23 years, 3 months ago
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
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
-------------------------
Advertisement
Well that ascii drawing sucked. So much for beginnign spaces.
Let me draw it again.

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


!explotion!
!explotion!

This topic is closed to new replies.

Advertisement