{"name":"screenToWorld","title":"screenToWorld","type":"command","url":"https://community.bistudio.com/wiki/screenToWorld","revid":379229,"updated":"2026-10-30T23:01:48Z","groups":["Positions"],"status":"ok","games":{"arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2 1.00","arma3_since":"0.50","description":"Returns the position on landscape (PositionAGL) corresponding to the given point on screen (in UI coordinates).\n\n> [!NOTE]\n> This command performs an intersection with the ground/water surface, from the camera position along the screenToWorldDirection vector up to `viewDistance` for terrain intersection and `2 * viewDistance` for water intersection. In other words, it is similar to doing:\n>\n> ```sqf\n> private _p1 = AGLToASL positionCameraToWorld [0, 0, 0];                    // camera position ASL\n> private _vector = screenToWorldDirection _screenPos;                    // \"aim\" vector\n> private _p2 = _p1 vectorAdd (_vector vectorMultiply viewDistance * 2);    // the ray does not go beyond 2 * view distance\n> ASLToAGL terrainIntersectAtASL [_p1, _p2]\n> ```","syntaxes":[{"syntax":"screenToWorld screen","params":[{"name":"screen","type":"Array with [x, y]","description":"screen position, see SafeZone for more information\n\n- x: Number\n- y: Number","type_expr":"Array"}],"returns":{"type":"PositionAGL","type_expr":"PositionAGL","description":"world position on surface [x, y, 0]","text":"PositionAGL, world position on surface [x, y, 0]"},"form":"unary","right":{"text":"screen"}},{"syntax":"camera screenToWorld position","since":"arma3 2.18","params":[{"name":"camera","type":"Object","description":"camera object","type_expr":"Object"},{"name":"position","type":"Array with [x, y]","description":"screen position, see SafeZone for more information\n\n- x: Number\n- y: Number","type_expr":"Array"}],"returns":{"type":"PositionAGL","type_expr":"PositionAGL","description":"world position on surface [x,y,0]","text":"PositionAGL, world position on surface [x,y,0]"},"form":"binary","left":{"text":"camera"},"right":{"text":"position"}}],"examples":[{"code":["private _wPos = screenToWorld [0.5, 0.5];"]},{"code":["private _wPos = _myCamera screenToWorld [0.5, 0.5]; // since Arma 3 2.18"]}],"see_also":["SafeZone","worldToScreen","screenToWorldDirection"]}