28.12.2009, 18:03
Quote:
Originally Posted by » RэРиR «
Quote:
|
if the distance is smaller than the previous distance, that object is closer
once you've looped trough all objects, the smallest one will be left :P (smallest distance)
here is some code for creating a closest object, it's from somewhere in my script :P for calculating closest objects
Код:
new closest; new dist = -1; for(new o=0; o<21; o++) { new dist2 = distance(i, ClosestPlatform[o][0], ClosestPlatform[o][1], ClosestPlatform[o][2]); if(dist2 < dist || dist == -1) { closest = o; dist = dist2; } }