Hi there,
I am trying to set up a basic system in which my AI cars drive around the track, by way of waypoints. I thiought this would be simple, but the code that I have isn’t working… each time the car hits a waypoint, it slows down and moves to the next. It only gets to a couple of waypoints before coming to a complete stop… any ideas!!!
for (var i = 0; i < Waypoints.length - 1; ++i)
{
transform.position = Vector3.MoveTowards(transform.position,Waypoints_.transform.position,(fSpeed * Time.deltaTime));_
-
}*
Actually... looking at it closely, it's only moving to the second waypoint... and it slows down.... REALLY weird...
– POLYGAMeSilly me, it's counting through the index every frame, but it takes time to perform the transform.Translate. DUH. I just need to make it wait until a waypoint is hit before it moves to the next. I'll be up all night, I know it... DAMN MY NOOBNESS!!!!!
– POLYGAMeIt also helps if you turn on the box colliders. DOH. FIXED!!!!!
– POLYGAMe