Lou Montana
Please note the difference :
- terrainIntersect
- terrainIntersectASL
- lineIntersects
- lineIntersectsWith
- lineIntersectsObjs
- intersect
Results appear below as you type; use the arrow keys to move through them.
Command · Markdown · JSON · original wiki page
Returns objects intersecting with the virtual line from begPos to endPos. By default, the resulting array of intersecting objects is unsorted (see sortByDistance).
Note
- Does not work under water.
- Max hardcoded distance is 1000m.
Since Arma 3 v2.20, there is an alternative syntax that does multiple checks in parallel, faster than multiple calls.
lineIntersectsWith [begPos, endPos, objIgnore1, objIgnore2, sortByDistance]
Parameters:
begPos: PositionASL - virtual line startendPos: PositionASL - virtual line endobjIgnore1: Object - (Optional) object to ignore. When testing intersections from an object/unit/vehicle, pass that object here to prevent intersections inside of the object.objIgnore2: Object - (Optional) another object to ignore. When testing intersections of a line between two objects, pass the second object here to prevent intersections inside of it being reportedsortByDistance: Boolean - (Optional) true: sort by descending distance (furthermost object first, closest object last); false: unsortedReturns: Array of Objects - intersecting objects
since arma3 2.20
lineIntersectsWith [[element1, element2, ...]]
Parameters:
elementN: Array with [begPos, endPos, objIgnore1, objIgnore2, sortByDistance]
Returns: Array with [result1, result2, ...] - each result is an Array of intersecting objects for the Nth element
_objects = lineIntersectsWith [eyePos player, AGLToASL screenToWorld [0.5, 0.5]];
Sort by distance:
_objects = lineIntersectsWith [eyePos player, AGLToASL screenToWorld [0.5, 0.5], objNull, objNull, true];
Ignore objects:
_objects = lineIntersectsWith [eyePos player, aimPos chopper, player, chopper];
Alternative syntax to check intersections in parallel:
private _enemies = units opfor;
private _enemyDataArray = _enemies apply { [eyePos player, aimPos _x, player, _x, true] };
private _result = lineIntersectsWith [_enemyDataArray];
lineIntersectsSurfaces · lineIntersectsObjs · lineIntersects · terrainIntersect · terrainIntersectASL · terrainIntersectAtASL · intersect · cursorObject · cursorTarget · checkVisibility
Please note the difference :