{"name":"screenToWorld","operator":null,"title":"screenToWorld","type":"command","url":"https://community.bistudio.com/wiki/screenToWorld","revid":377892,"updated":"2026-01-05T17:38:23Z","groups":["Positions"],"status":"ok","replaced_by":[],"games":[{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma2","name":"Arma 2","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"screen","type":"Array with [x, y]","optional":false,"default":null,"description":"screen position, see SafeZone for more information\n- x: Number\n- y: Number","types":["Array"],"since":null,"text":"screen: Array with [x, y] - screen position, see SafeZone for more information\n- x: Number\n- y: Number"}],"returns":{"type":"PositionAGL, world position on surface [x, y, 0]","types":["PositionAGL"],"description":null,"text":"PositionAGL, world position on surface [x, y, 0]"},"form":"unary","operator":null,"left":null,"right":{"text":"screen","types":["Array"]}},{"syntax":"camera screenToWorld position","since":"arma3 2.18","effect":null,"exec":null,"params":[{"name":"camera","type":"Object","optional":false,"default":null,"description":"camera object","types":["Object"],"since":null,"text":"camera: Object - camera object"},{"name":"screen","type":"Array with [x, y]","optional":false,"default":null,"description":"screen position, see SafeZone for more information\n- x: Number\n- y: Number","types":["Array"],"since":null,"text":"screen: Array with [x, y] - screen position, see SafeZone for more information\n- x: Number\n- y: Number"}],"returns":{"type":"PositionAGL, world position on surface [x,y,0]","types":["PositionAGL"],"description":null,"text":"PositionAGL, world position on surface [x,y,0]"},"form":"binary","operator":null,"left":{"text":"camera","types":["Object"]},"right":{"text":"position","types":[]}}],"examples":[{"text":"```sqf\nprivate _wPos = screenToWorld [0.5, 0.5];\n```","code":["private _wPos = screenToWorld [0.5, 0.5];"]},{"text":"```sqf\nprivate _wPos = _myCamera screenToWorld [0.5, 0.5]; // since Arma 3 2.18\n```","code":["private _wPos = _myCamera screenToWorld [0.5, 0.5]; // since Arma 3 2.18"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["SafeZone","worldToScreen","screenToWorldDirection"],"notes":[],"categories":["Arma 2: New Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Positions","Introduced with Arma 2 version 1.00","Scripting Commands","Take On Helicopters: Scripting Commands"]}