{"name":"inPolygon","title":"inPolygon","type":"command","url":"https://community.bistudio.com/wiki/inPolygon","revid":379530,"updated":"2026-10-31T00:51:06Z","groups":["Positions"],"status":"ok","games":{"arma3":"1.54"},"since":"arma3 1.54","arma3_since":"1.54","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","params":[{"name":"position","type":"Position3D or Arma 3 v2.14 Object","type_expr":"Position3D | Object"},{"name":"polygon","type":"Array of Position3D","description":"positions in format: [position1, position2...., positionN]","type_expr":"Array<Position3D>"}],"returns":{"type":"Boolean","type_expr":"Boolean"},"form":"binary","left":{"text":"position"},"right":{"text":"polygon"}}],"examples":[{"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"]}],"see_also":["in","inArea","inAreaArray","drawPolygon"]}