Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

Determining Which GameObject Is Closer To An Object.

$
0
0
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 :
Code (JavaScript):
  1. #pragma strict
  2. import System.Collections.Generic;
  3.  
  4. var ai : GameObject[];
  5. var myList = new List.<float>();
  6.  
  7. function Start () {
  8. ai =...
Determining Which GameObject Is Closer To An Object.

Viewing all articles
Browse latest Browse all 1466670

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>