   Getting the UP vector from heading and pitch quaternions...
  RT. How would I go about doing this?This is to allow strafing, btw. I'm planning on crossing the UP with the LOOK vector...unless there's a more efficient/direct way of doing this?[edited by - Silex on May 29, 2004 4:25:54 PM]
  "unless there''s a more efficient/direct way of doing this?"Not really. The side vector is simply the cross product of the forward and up vectors. ;  I was wondering if perhaps the right vector had already been calculated in the process of the creating the view matrix.In case this''ll help anyone figure out what I''m trying to do, here''s the function where I create the view vector and do the quaternion math:    //create quaternions to represent rotations   pitch.CreateFromAxisAngle(1.0f,0.0f,0.0f, pitchdeg);heading.CreateFromAxisAngle(0.0f,1.0f,0.0f, headingdeg);//combine the pitch and heading rotationsq = pitch * heading;q.CreateMatrix(matrix);//send matrix to openglglMultMatrixf(matrix);//calc j component of direction vectorpitch.CreateMatrix(matrix);dir.j = matrix[9];//combine heading and pitch to get i and j components of   dir vectorq = heading * pitch; //quaternion multiplication not commutativeq.CreateMatrix(matrix);dir.i = matrix[8];dir.k = matrix[10];//scale direction according to speeddir.Unit();   [...........CODE OMITTED..........]dir *= vel;//increment position by dir vectorpos.x += dir.i;pos.y += dir.j;pos.z += dir.k;//update scene center based on camera locationglTranslatef(-pos.x,-pos.y,pos.z);I need a way to extract the up vector so I can cross it with the dir one to have an axis to strafe along, or a way to directly grab this strafe vector. ;  For some reason the code block won''t show up in my browser, but yes, you should be able to extract the forward, up, and side vectors from the view matrix. Depending on how the matrix is set up, it should be either:side [0, 1, 2]up [4, 5, 6]forward [8, 9, 10]or:side [0, 4, 8]up [1, 5, 9]forward [2, 6, 10] ;  So could I just use the side vector as the strafe axis? Would this take into account the pitch and heading rotations? Or should I use the up vector and cross it with my working dir vector? ;  "So could I just use the side vector as the strafe axis? Would this take into account the pitch and heading rotations? Or should I use the up vector and cross it with my working dir vector?"If you take the vectors straight from the matrix, the side (strafe) vector should already be the cross product of the forward and up vectors. So you should just be able to use it as is. 