Hi, I have a problem that i think is not big deal but i'm having a hard time solving it. First i made a car and i made a function that makes the camera go behind the car and always looks at it so the function looks like this:


function SET_camera(){
while(1){
camera.x=sasija_ent.x-200*cos(sasija_ent.pan)*sin(z_ang);
camera.y=sasija_ent.y-200*sin(sasija_ent.pan)*sin(z_ang);
camera.z=sasija_ent.z+200*cos(z_ang);

vec_set(look_point,sasija_ent.x);
vec_sub(look_point,camera.x);
vec_to_angle(camera.pan,look_point);
camera.arc=100;

wait(1);
}
}

Where the sasija_ent is the car entity; but it doest'n look vary good because
the car is phisycs entity and whent it shakes a bit the camera makes vary rapid moves. So i made another function that smoothes the camera motion a bit, and here it is:
function SET_camera(){
while(1){


xy_ang+=(abs(sasija_ent.pan)-xy_ang)/10;


camera.x=sasija_ent.x-200*cos(xy_ang)*sin(z_ang);
camera.y=sasija_ent.y-200*sin(xy_ang)*sin(z_ang);
camera.z=sasija_ent.z+200*cos(z_ang);

vec_set(look_point,sasija_ent.x);
vec_sub(look_point,camera.x);
vec_to_angle(camera.pan,look_point);
camera.arc=100;

wait(1);
}
}

But when i made a simple panel just to display digits of sasija_ent.pan
i found out that sasija_ent.pan has values like that it's not sasija_ent.pan but ang(sasija_ent.pan);
so the function does its job just when the sasija_ent.pan is a positive value from 0-180;
The reason i wrote this"abs(sasija_ent.pan)-xy_ang"is because when it is "sasija_ent.pan-xy_ang" the xy_ang follows the sasija_ent.pan at a slower rate than sasija_ent is actually rotating. So when The sasija_ent.pan goes form 1 to -179 when it's rotating the camera makes full circle around the car to follow the value of -179;
I know all this is vary confusing but if someone can solve this i'll apriciate it.
thanx any way.
And if someone has a function that makes the movement of the camera soother it would be nice to post it here;
THANX