# vector rotation

I tried this post in the math/algo forum but I think its down.

how do I calculate these three vectors:

x,y,z

1,0,0
0,1,0
0,0,1

to align with a rotated modelmatrix to allow for relative movement?

This might help with understanding of question

I can look around with the mouse:

void LookAround(float x,float y)//x,y from mouse
{
GLfloat MMatrix[16];

glGetFloatv(GL_MODELVIEW_MATRIX,MMatrix);
glLoadIdentity();
glRotatef(sqrt(xx+yy)*magicnumber,-y,x,0.0);
glMultMatrixf(MMatrix);
}

multiple LookAround() Functions leads to rotations in all directions not just x and y

Now I want a funtion that makes me move relative to the new rotation:

void MoveAround(float x,float y,float z)//get a velocity vector eg: (0,0,1)=1 forward
{
GLfloat MMatrix[16];
float rotatedX,rotatedY,RotatedZ;

glGetFloatv(GL_MODELVIEW_MATRIX,MMatrix);
//switch(explanation){
//case abstract_math:
//vector matrix math that i don’t know, likely full of sin()'s and cos()'s
//break;
//case simpler_fuctions:
//translation manipulation with opengl fuctions such as glRotate() and glMultMatrixf()

glTranslate(rotatedX,rotatedY,RotatedZ);
}

I will probably need those vectors for collision response and rotational bounce or something anyway.

Math & algorithms is up, I’ll move your thread there.

– Tom