Well, I couldn't get it to work and then saw the flaw in my plan anyway. I moved my ideas on to something else. I probably have 3 times as much commented out code than actual working code now.
360 == 0 deg is a real pain in the bum.
I am making a trailer that should go only +- 60 degrees from the direction of the tow truck.
I can check to see if the trailer is in a valid position fine.
The problem comes when deciding which way it is wrong. If its >+60 I set it to +60. If its <-60 I set it to -60. Around VDir=180 and 360 it goes a little funny.
Im currently measuring the angle from the tow truck to the trailer using atan2 and comparing that to the TDir angle.
It works brilliantly as long as you are turning right
When you go left it flickers in between correcting to +60 and -60 when the tow truck heading hits 0.