Arma 3 Scripting

ctrlMapScreenToWorld

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

Command · Markdown · JSON · original wiki page

Description

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

Syntax

control ctrlMapScreenToWorld [x, y]

Parameters:

Returns: Position2D - world coordinates

Examples

Example 1

_worldCoord = _control ctrlMapScreenToWorld _ScreenCoord;

Example 2

_worldCoord = _control ctrlMapScreenToWorld [_x, _y];

Example 3

_worldCoord = findDisplay 12 displayCtrl 51 ctrlMapScreenToWorld [0.5, 0.5];

See also

ctrlMapWorldToScreen · posScreenToWorld · posWorldToScreen · findDisplay · displayCtrl

Community notes

LowFly

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;

Ceeeb

The command parameters are screen position coordinates, which may not equate to the map control's coordinates. A map control's screen coordinates and size can be found use the ctrlPosition command. This is an issue when using the Arma 3 in-game map, which is not fullscreen (all previous titles used full screen map controls, so map control coords did equate to screen coords).