Hi - This topic is diseptively complicated.
Quick Background: I'm trying to make a top down racer. Specifically I want to explore a 'slot car' concept where the car steers itself and the user is really only controlling the throttle. Too much throttle and the car will drift wide of the turn (something called 'understeer').
General Approach: I have 'markers' throughout the map that have an instance variable called "GateID". Each car has a "GateID" as well. The car will drive toward the marker with GateID = 1, and when it reaches that, it moves on to GateID =2, etc.
Steering Approach: I've placed a line on the front of the car (which we'll call "Pointer") that points toward the next Marker. The thought, was that I could control the steering by taking the difference between the Car's Angle, and the Pointer's Angle. So if the car is facing 'up', i.e. 90 degrees, and the Pointer is facing 'right', i.e. 0 degrees, then the car needs to turn right. So then if Car > Pointer, turn right ... right? Not exactly. Using the same example, Car = 90 degrees and Pointer = 360 degrees you would then think you need to turn left because 90 < 360 ... but you still do need to turn right.
I hope all this makes sense. Has anyone had any luck with this? I just can't seem to make sense of the angles! :(
Thanks