# NNS_G3dWorldPosToScrPos

## Syntax

      #include <nnsys/g3d/util.h>

      int
      NNS_G3dWorldPosToScrPos(
          const VecFx32* pWorld,
          int* px,
          int* py
      );

## Arguments

pWorld | Pointer to the world coordinate position
px | Pointer to the `x` coordinate on the screen
py | Pointer to the `y` coordinate on the screen

## Return Values

Returns `0` if `*px` and `*py` are inside the viewport. Returns `-1` if they are outside of the viewport.

## Description

Looks for the position on the screen that corresponds to the position on the world coordinates. The camera matrix and the projection matrix must be configured in the `NNS_G3dGlb` structure. Even if the return value is `-1`, the value is stored in `*px` and `*py` and can be used as the directional guide. When applying a horizontal offset to the 3D screen by using the Nitro-SDK `G3X_SetHOffset` function, only the offset portion of the obtained x coordinate needs to be moved.

## See Also

`NNS_G3dLocalOriginToScrPos`, `NNS_G3dScrPosToWorldLine`

## Revision History

2004/11/01 Initial version.

CONFIDENTIAL