# getScreenFromWorldPosition (Client)

> Projects a world point onto the screen, with the current frame's camera.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: World and weather
- **URL**: https://wiki.mymp.gg/en/getScreenFromWorldPosition

## Syntax

```lua
float, float, float|false getScreenFromWorldPosition(float x, y, z [, float edgeTolerance = 0, bool relative = true])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `x, y, z` | `float` | The point in the world. A `vec3` also works. |
| `edgeTolerance` | `float` | How far off screen the point may be and still be returned. *(default: `0`)* |
| `relative` | `bool` | If `true`, the tolerance is a fraction of the screen's width and height; if `false`, it is in pixels. *(default: `true`)* |

## Returns

The `x, y` coordinates in pixels and the point's distance from the camera along its view direction. `false` if the point is behind the camera or off screen past the tolerance.

## Example

```lua
addEventHandler("onClientRender", root, function()
    local pos = getElementPosition(localPlayer)
    local sx, sy = getScreenFromWorldPosition(pos.x, pos.y, pos.z + 1.2)
    if sx then
        dxDrawText("Me", sx, sy)
    end
end)
```

## See also

- [getWorldFromScreenPosition (Client)](https://wiki.mymp.gg/en/getWorldFromScreenPosition.md): Turns a screen point, at a depth, into a world point, with the current frame's camera.
- [getScreenSize (Client)](https://wiki.mymp.gg/en/getScreenSize.md): Returns the size of the game's screen in pixels.
- [dxDrawText (Client)](https://wiki.mymp.gg/en/dxDrawText.md): Draws text on the screen for one frame, inside a box.
