Most of us programmers may have already encountered this annoying problem which is quite hard to get right There is already a topic about arbitrary rotation but it seems this solution only works if the angles are predetermened before runtime and thus changing the angles during runtime will still give an inaccurate rotation around the pan or z axis while tilt equals 90 or -90 degrees.

I've tried most methodes like c_rotate with setting the USE_AXISR, inverting the angles for local rotation, using ang_rotate and ang_add but none of it will work. This code gives the most accurate rotation:
Code:
 
var temp2[3];
vec_set(temp,vector(my.pan,0,0));
vec_rotate(temp,vector(-my.pan,0,0)); // local rotation by inverting the angle
vec_to_angle(temp2,temp); // converting from vec to ang
ang_rotate(test.pan,temp2); // rotating initial angle by entity's pan angle



The result of this code is that the entity rotates around his z-axis (panning) while tilt is 90 or -90 degrees but the rotation is not only around the z-axis but also around his x-axis(rolling) at the same time and too fast as well ^^
All help is welcome

Thanks in progress

Frazzle


Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB