Angles from vectors (basics)

Hi,

Another basic math problem:

If the camera settings are the position and the direction (point, and vector from this point),
how do I determine the angles I should rotate the camera in the axis?

Is it just the arcus tangens funcion
( rotate4f(1.0f, 0.0f, 0.0f, atan2f(old_direction.x, new_direction_x)) ? or something like this? )?

Yeah, I know it’s basics, but I’m in rush to make it working as fast as it’s possible, so I’m just trying to determine where the possible errors could be.

google “glulookat”

If you just need to rotate the camera, then gluLookAt is what you need.
You could also use vector math to create camera’s matrix directly from forward and up vector.

If you need the angles then rcus tangens is what you need, but remember that it only works in -90 to +90 degrees - you will need to check signs of the vector to get proper angle value.

I’ll just assume that you only need gluLookAt and will not explain other two cases.

Ok, I’ll implement math myself… as I’ve just have readen, in fact it was still handled by CPU, so it doesn’t matter whose implementation I’ll use.

The thing I need to do is to rotate things attached to node without using push/pop_matrix mechanism (I need it just for colission detection).