I have an array of AI cars and a checkpoint.
What I'm trying to do is get which car is closer to that checkpoint in order.
I've calculated the distance from the checkpoint to the cars and I have a List that sorts the distances in order but I can't figure out a way to get which car is closer to the checkpoint.
Here's my code :
Determining Which GameObject Is Closer To An Object.
What I'm trying to do is get which car is closer to that checkpoint in order.
I've calculated the distance from the checkpoint to the cars and I have a List that sorts the distances in order but I can't figure out a way to get which car is closer to the checkpoint.
Here's my code :
Code (JavaScript):
- #pragma strict
- import System.Collections.Generic;
- var ai : GameObject[];
- var myList = new List.<float>();
- function Start () {
- ai =...