Hi, i'm trying to create script physics for a vehicle. I'm not trying ask how to do that, but I have this little problem and i'm curious of what you guys might do in my case.

I'm trying to write a small set of instructions that causes the velocity of the tire to be reduced by a "friction_force" (nevermind the friction_dir).. Basicaly, like a real car, assuming you are not actualy turning, if the front tires are turned (say) 45 degrees to the right, then you would have a force against the velocity of the wheel at a magnitude equall to 50% of the maximum grip of that tire.

If you look at the PATTERN, you might get an idea what i'm talking about.. The degrees relitive means the difference in the .pan angle between the tire.pan and the true direction of velocity.

*Degrees
Relitive *Percent of force
against the velocity

At 0 -- 0 force |
At 22.5 -- 25% force
At 45 -- 50% force /
At 67.5 -- 75% force
at 90 -- 100% force --
at 112.5 -- 75% force
at 135 -- 50% force \
at 157.5 -- 25% force
at 180 -- 0% force |


Now if I can find a way to calculate the difference between the wheel.pan and the velocity_dir.pan, then thats all I need.
BUT!

It's not as easy as:

anglediff = velocity_dir.pan - wheel.pan;

or

vec_diff(anglediff,velocity_dir.pan,wheel.pan;

Those won't work BECAUSE of this...

If my velocity_dir.pan was facing exactly "20" in world coords and my wheel.pan is facing "350" in world coords, and then I subtracted them, this is what it would look like...

The REAL difference in degrees is "30".

But the result you get when subtracting this in world coords with a "360 degree" system is.
20 - 350 = -330 //!!

I've also tryed using ang(wheel.pan) and ang(velocity_dir.pan) and it worked until it reached 180 degrees and then spiked for a second (that means every time the car is facing 180 in world coords, there will be a spike effect in the physics).