I’ve finished a system that uses built-in arrays and basically just points toward it and applies various amounts of force. Works’ a treat, another array is kept that keeps ‘speed’ properties which is so i can force the AI to slow down in some areas.
However, since its the backbone of a fairly expensive title, I’m probably not going to share code
A waypoint is simply a navigation point for your vehicle to drive through. The simplest system would simply make your vehicle “lookat” the next waypoint like this:
then move it forward by a certain speed per frame, until it’s close enough to move to the next waypoint, like so:
if ( Vector3.Distance ( Car.transform.position, Waypoint.transform.position ) < 1.0f )
Car.transform.position += Car.transform.forward * CarSpeed;
else
// Find next waypoint
This is basic, to demonstrate the theory behind it. This will always look very “angular” (kinda like the light bikes in TRON), but it’ll do the job.
The next thing to do is to use transformpoints on the car (look up transformpoint and inversetransformpoint), decide where you want to steer your car, create a rotation which would send your car in the right direction, then Quaternion.Slerp toward the right direction, whilst moving your car forward.
Unity doesn’t “do” this out of the box (as in, there’s no built in solution) but it’s pretty easy if you put your mind to it.