# getScreenCoordinates question

I'm using getScreenCoordinates to lock my reticule on a target vessel. It works ok, but there are two odd things. One, I've noticed that when I'm facing 180 degrees away from the target the reticule will appear in the middle of my screen. I know I can use the Z axis to figure out of the object is in the front 180 or rear 180. That's fine as I try to lock the reticule to the appropriate location on the screen edge if the target goes out of view. The problem is the numbers returned from getScreenCoordinates get very large and don't seem to make much sense making it hard to write a reliable algorithm to lock it to the border. Could someone explain what the data being returned means exactly?

The method returns the 2D coordinates a 3D point in the world would be rendered to screen if the screen was infinitely large (instead of returning NaN when the world coordinates would not be displayed on the actual screen it). That should explain the large values to you.

I think I use a similar technique to what you want for showing target markers:

```protected void moveMarker( final Marker marker, final Vector3f worldPosition ) {         final DisplaySystem display = DisplaySystem.getDisplaySystem();         display.getScreenCoordinates( worldPosition, tmp );            //keep marker on screen border if would move off the screen    float x = tmp.x / display.getWidth() - 0.5f;    float y = tmp.y / display.getHeight() - 0.5f;    if ( Math.abs( x ) > 0.5f || Math.abs( y ) > 0.5f || tmp.z >= 1 ) {       //is off screen       float off;       if ( Math.abs( x ) > Math.abs( y ) ) {           off = 0.5f / Math.abs( x );       } else {           off = 0.5f / Math.abs( y );       }       if ( tmp.z >= 1 ) {           off = -off;       }       tmp.x = ( x * off + 0.5f ) * display.getWidth();       tmp.y = ( y * off + 0.5f ) * display.getHeight();    }    //move it    marker.setLocation( (int) tmp.x - marker.getWidth(), (int) tmp.y - marker.getHeight() ); }```

(maybe a bit complicated haven't reviewed it, but seems long)

Thank you sir. That did the trick (with only slight modifications).