Solved! I finally solved!
In this way there is no problem related to -180 -> 180 barrier!
The function below "smooth_movement()" makes the dirty job.
I even included a brief example (inside forever loop) to show how I used to move camera to follow smoothly my car.
I hope this will help you.
Thank you
function smooth_movement(float argNewValue, float argOldValue, float increments)
{
float slip;
float calc1;
calc1 = argOldValue - argNewValue;
if( abs(calc1) > 180 ) {
calc1 = 360 + calc1;
}
slip = calc1 / increments;
argOldValue -= slip;
return(argOldValue);
}
var relativeCamera_angle = 0;
while(1) {
relativeCamera_angle = smooth_movement(pMyCar.pan, relativeCamera_angle, 300);
camera.x = pMyCar.x - relativeCamera_offset * cos(-relativeCamera_angle);
camera.y = pMyCar.y - relativeCamera_offset * sin(relativeCamera_angle);
vec_set(temp, pFocus.x);
vec_sub(temp, camera.x);
vec_to_angle(camera.pan, temp);
}