Original Post
Hey Im making a camera class for opengl using quaternions and im having some trouble getting movement down here is my logic: 1. get movement and rotation amounts from input and save them in floats 2. using axis angles turn rotation amounts into quaternions 3. multiply quaternions together and form matrix from them 4. allow glmultmatrix()to do its thing ***All of the above works fine*** 5. get the direction vector from the matrix 6. get the strafe vector using cross product of the forward vector and the up vector 7. multiply forward and strafe vectors by their movement amounts 8. add forward and strave vectors to position vector 9. glTranslatef() and whalla How do i do step 5? this is the code. it may be important to note that i am using the math3d++ library to do all the math thanks - las
void CCamera::Update () {
//this is to hold the perspective matrix
mat4 m;
//uh forward, and strafe
vec3 f, s;
//get our rotation
quat q= heading*pitch;
***this is it how do i get the vector
of the forward direction from my martix***
f=???????????;
//get the strafe direction
s = cross (f, vec3(0.f, 1.f, 0.f));
//get the movement amounts
f *= fVel;
s *= sVel;
//update position vector
pos += (s+f);
// rotate
glMultMatrix (m);
//move
glTranslatef(-pos[0], -pos[1], pos[2]);//
}