2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-09-21 11:08:10 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
2019-12-07 20:58:21 +00:00
|
|
|
* Returns the the first intersection with terrain between two positions.
|
2015-01-16 23:21:47 +00:00
|
|
|
*
|
2015-09-21 11:08:10 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: PositionASL <ARRAY>
|
|
|
|
* 1: PositionATL <ARRAY>
|
|
|
|
* 2: Accuracy <NUMBER>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* 0: Intersects <BOOL>
|
|
|
|
* 1: Intersection Position ASL <ARRAY>
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [[1,2,3], [0,0,5], 5] call ace_common_fnc_getFirstObjectIntersection
|
|
|
|
*
|
2015-09-21 11:08:10 +00:00
|
|
|
* Public: Yes
|
2015-01-16 23:21:47 +00:00
|
|
|
*/
|
|
|
|
|
2019-12-07 20:58:21 +00:00
|
|
|
params ["_source", "_destination"];
|
2015-05-14 18:06:06 +00:00
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _result = [false, [0, 0, 0]];
|
2019-12-07 20:58:21 +00:00
|
|
|
private _hits = lineIntersectsSurfaces [_source, _destination, objNull, objNull, true, -1];
|
|
|
|
{
|
|
|
|
_x params ["_pos", "", "_obj"];
|
|
|
|
if (!isNull _obj) exitWith {
|
|
|
|
_result = [true, _pos];
|
2015-01-18 19:09:19 +00:00
|
|
|
};
|
2019-12-07 20:58:21 +00:00
|
|
|
} forEach _hits;
|
2015-01-16 23:21:47 +00:00
|
|
|
_result
|