action plane_nearto_screen()
{
VECTOR temp;
while(me)
{
vec_set(temp,my.x);
if (vec_to_screen(temp,camera) != NULL) // if visible on screen, convert to screen coordinates
{
if(vec_dist(temp,vector(screen_size.x / 2,screen_size.y / 2,0)) < 30) // Distanz zur Bildschirmmitte kleiner 30
{
nearest_plane = me; // Set to the nearest plane
}
}
wait(1);
}
}