{"name":"inPolygon","operator":null,"title":"inPolygon","type":"command","url":"https://community.bistudio.com/wiki/inPolygon","revid":377566,"updated":"2026-01-02T06:55:31Z","groups":["Positions"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.54"}],"since":{"game":"arma3","name":"Arma 3","version":"1.54"},"arma3_since":"1.54","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Checks whether position is inside given polygon. The polygon is only checked in 2 dimensions, i.e. the value of Z is ignored.","syntaxes":[{"syntax":"position inPolygon polygon","since":null,"effect":null,"exec":null,"params":[{"name":"position","type":"Position3D, Arma 3 v2.14 Object or Group","optional":false,"default":null,"description":null,"types":["Position3D","Object","Group"],"since":null,"text":"position: Position3D, Arma 3 v2.14 Object or Group"},{"name":"polygon","type":"Array of Position3D","optional":false,"default":null,"description":"positions in format: [position1, position2...., positionN]","types":["Array","Position3D"],"since":null,"text":"polygon: Array of Position3D - positions in format: [position1, position2...., positionN]"}],"returns":{"type":"Boolean","types":["Boolean"],"description":null,"text":"Boolean"},"form":"binary","operator":null,"left":{"text":"position","types":["Position3D","Object","Group"]},"right":{"text":"polygon","types":["Array","Position3D"]}}],"examples":[{"text":"```sqf\nprivate _isInside = [100, 100, 0] inPolygon [[0, 0, 0], [1000, 1000, 0], [1000, 0, 0]];\n```","code":["private _isInside = [100, 100, 0] inPolygon [[0, 0, 0], [1000, 1000, 0], [1000, 0, 0]];"]},{"text":"```sqf\nprivate _markerName = \"_USER_DEFINED #0/0/1\";\n\nprivate _xy2DPositions = markerPolyline _markerName;\nprivate _positions = [];\n\n// let's convert these x,y coordinates to \"normal\" position arrays\nfor \"_i\" from 0 to count _xy2DPositions - 1 step 2 do\n{\n    _positions pushBack [_xy2DPositions select _i, _xy2DPositions select (_i + 1), 0];\n};\n\nplayer inPolygon _positions; // true if in the drawn shape, false if not\n```","code":["private _markerName = \"_USER_DEFINED #0/0/1\";\n\nprivate _xy2DPositions = markerPolyline _markerName;\nprivate _positions = [];\n\n// let's convert these x,y coordinates to \"normal\" position arrays\nfor \"_i\" from 0 to count _xy2DPositions - 1 step 2 do\n{\n\t_positions pushBack [_xy2DPositions select _i, _xy2DPositions select (_i + 1), 0];\n};\n\nplayer inPolygon _positions; // true if in the drawn shape, false if not"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["in","inArea","inAreaArray","drawPolygon"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Positions","Introduced with Arma 3 version 1.54","Scripting Commands"]}