Quote:
Hmmm...when I look at the Now_Rot.x, its working sometimes, but often it switches to 300 and something (way to high) and has the wrong sign.
Dont worry about Now_Rot or Old_Rot jumping to the higher values, its not important. VEC_DIFF "corrects" those
odd values before doing its difference'ing. So Rot_Speed will be correct, even if Now_Rot or Old_Rot look
wrong(or very different), thats why the VEC_ADD lines in my code are OPTIONAL.
To see see Now_Rot and Old_Rot as real angles(-180 to +180), use this code instead.
Code:
VECTOR Old_Rot, Now_Rot, Rot_Speed;
vec_set(Old_Rot, my.pan);   //Start Euler ANGLE in degrees (not speed)
vec_set(Old_Rot, vector(ang(Old_Rot.x),ang(Old_Rot.y),ang(Old_Rot.z)));  //(optional) CORRECT odd looking angles to -180 to +180 range
wait(1);
vec_set(Now_Rot, my.pan);   //Current Euler ANGLE in degrees (not speed)
vec_set(Now_Rot, vector(ang(Now_Rot.x),ang(Now_Rot.y),ang(Now_Rot.z)));  // (optional) CORRECT odd looking angles to -180 to +180 range
vec_diff(Rot_Speed, Old_Rot, Now_Rot);
vec_set(Rot_Speed, vector(ang(Rot_Speed.x),ang(Rot_Speed.y),ang(Rot_Speed.z)));  // (optional) CORRECT odd looking angles to -180 to +180 range


BTW those odd values are just "the correct value" with 180 spuriously(?) added or subtracted,
because they are being treated as generic vectors, rather than angles.

Just remember, in BOTH of my code samples, the VEC_ADD lines are optional just to improve the LOOK
of Old_Rot and Now_Rot, they are just eating horsepower if you dont need to VISUALLY use these values later.
Even though the numbers may LOOK weird without the VEC_ADD or ANG() changes, the engine handles them perfectly correctly.


Quote:
But what are the other 2 values in the Now_Rot vector meaning ? Have they any sense ?
AND
-Tilt is going from 0 to 90 to 0 to -90 to 0. (and it seems impossible to me to calculate the correct direction here)
The other two values are the tilt and roll values. They apply right through the calculations.
So Rot_Speed.X is how fast the PAN is rotating, + is rotating clockwise, - is rotating anti-clockwise.
So Rot_Speed.Y is how fast the TILT is changing, + is going up(higher), - is going down(flatter).
So Rot_Speed.Z is how fast the ROLL is changing, + is rolling clockwise around its own X axis), - is anti-clockwise.

Footnote: Tilt CAN go beyond +/-90. Think of it like this, between 0 and +/-90, the pan is leaning forwards,
but beyond 90 its leaning backwards, and when that happens, pan and roll will appear reversed.
Imagine .... Tilt=0 is looking straight ahead, +90 is straight up(you see sky), -90 is straight down(you see feet),
(tricky part) -120 is looking between your knees(seeing the ground behind you),
(trickier part) +120 is looking behind you by leaning backward(seeing the sky behind you).



Quote:
Ok always important to know:
-roll and pan are going from 0 to 180 then -180 to 0.
Correct, but thats only half of the truth.
And a tricky one but once you understand, your problems of the odd numbers will all make sense.

## IMPORTANT ## - Understanding this will make everything else make sense and easier to follow.
Rotation degrees go from -180 to +180, right?
So that means 0 is straight ahead, 90 is true right, -90 is true left, and +180 and -180 are BOTH straight behind.
CORRECT......But... in other types of mathematic situations
Rotation degrees go from 0 to 360.
So that means 0 is straight ahead, 90 is true right, 180 is straight behind, 270 is true left, and 360 is straight ahead too.
BOTH correct. Here is an attempt to make a visual representation of the two views side-by-side.
Code:
ANGLE   -180    -90     0     +90     +180
          |------|------+------|--------|   
VECTOR   180    270   0/360    90      180  

can also be viewed as

ANGLE       0         +90      +/-180       -90           0
            |----------|----------+----------|------------|   
VECTOR    0/360        90        180        270         0/360
Now do you see where the odd numbers were coming from?
The odd numbers you are seeing is when the two types of mathematic representations overlap.
But VEC_DIFF converts both vectors to the same type before it calculates.


I hope this is of some help...




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial