Arma 3 Scripting

posScreenToWorld

  • Arma 3 v0.50
  • First in Armed Assault v1.00

Command · Markdown · JSON · original wiki page

Description

Converts map screen coordinates into world coordinates. Unlike ctrlMapScreenToWorld, this command returns world position is format [x, y, 0], otherwise it is identical to it.

Syntax

map posScreenToWorld [x, y]

Parameters:

Returns: Position3D - world position in format [x,y,0]

Examples

Example 1

_worldCoord = _control posScreenToWorld _ScreenCoord;

Example 2

_worldCoord = _control posScreenToWorld [_x, _y];

Example 3

_worldCoord = _control posScreenToWorld [0.5, 0.5];

See also

posWorldToScreen · ctrlMapScreenToWorld · ctrlMapWorldToScreen

Community notes

LowFly

Notes:

You can get the screen coordinates by the UI Event Handlers onMouseButtonDown, onMouseButtonUp, onMouseButtonClick, onMouseButtonDblClick.

The return Array is in 2D, you can use it with all set-position commands.

_x = returnArray select 0;
_y = returnArray select 1;