Almost forgot...
On the last line
a = (2 * pi) - arccos(d.z);
if you don''t use a lot of decimal places for pi you WILL!!! get rounding errors in the result! I recomend using
a = - arccos(d.z);
OpenGL will accept the negative rotation value so this won''t be a problem.
Popular Topics
Advertisement