3D Math (Vector & Matrices)
I have question about 3D math. I have a vector representing the direction i want my matrix to face. How can I change the forward(z axis) vector of the matrix to the direction without distorting the X or Y axis.
I know one way is to use dot product.
cos(theta) = vec1 dot vec2
float angle = arccos(currentMatrix.AxisZ dot directionVector);
I was wondering if there was a less expensive way to do it. Arc cosine is an expensive call I hear.