Racing Game, Car AI

Good Evening developers
I am working on a racing game project.
I need to create a waypoint system with beziered curves. I want to calculate the maximum speed and the minimum speed determinated by the maximum steer angle (that is variable determinated by rigidbody speed) and the wheel friction.
Also I want to create a perfect Raycast Avoidance System.
Thanks, have a nice day
Johny Dee

I am using Andrew Gotw script for start, and now I am implementing the source.
On the unity track eveything was going well, but on a casual track made by EasyRoad it doesn’t want to follow the path described by this waypoints.
I have tried creating the minimal waypoints, and it doesn’t follow the path, I have also tried to creating a waypoint every few meters, and it doesn’t follow the path again!
So my problem is:
Why this AI follows the path perfeclty on one track, and not on another?
I have tried this curves with my car, and I was going at 33 meters per second, and I have assigned to the AI an maximum speed of 25 meters per second.

Come on, guys, please help!

Why not writing your own AI? You can set the steer of your vehicle to follow the angle that is between the vehicle position and the next waypoint position. If the angle is too sharp you make the vehicle slow down or accelerate if the next waypoint is pretty much ahead. You could come up with a simple formula to calculate those values. You can cast a ray ahead of the car to detect proximity with other cars. If you are getting near a car you override the waypoint follow and execute an over pass script or mantain distance or what ever you need. Also to make it look smooth you may need to predict the next waypoint before actually reaching the target waypoint. You could just set to trigger next waypoint when you are at certain distance from target waypoint.

Gabiel.