I followed this tutorial to implment the AI car racing game, but I'm in trouble with the direction of the car.
when a car need to adjust its direction, I subtracted the current direction from the target directon, depends on the value of subtraction. I called TurnRight() or TurnLeft() functions to change the current direction in order to let it get close to the target direction. (I will calculate the target direction every tick).
the problem is when the value of the direction (store as the radians way) changed from the value like 7.8 to 7.8-2PI. the car will not turn the right way. it will keep calling TurnRight() and TurnLeft() sequentially..
how to solve this problem ..
looking forward to your help.. and sorry for my poor English.