mirror of
https://github.com/acemod/ACE3.git
synced 2025-07-26 05:12:54 +00:00
- Replace firedNear by firedBIS XEH - Calculate the origin of the backblast and overpressure zones using the projectile position and direction - Handle all effects for each unit on their local machine - Posibility of drawing effect cone for debug - Simplified angle calculations
41 lines
945 B
Plaintext
41 lines
945 B
Plaintext
/*
|
|
* Author: Commy2 and CAA-Picard
|
|
*
|
|
* Calculate the distance to the first intersection of a line
|
|
*
|
|
* Argument:
|
|
* 0: Pos ASL of origin (Array)
|
|
* 1: Direction (Array)
|
|
* 2: Max distance to search (Number)
|
|
*
|
|
* Return value:
|
|
* Distance to intersection (+- 0.1 m)
|
|
*/
|
|
#include "script_component.hpp"
|
|
|
|
private ["_distance", "_interval", "_line", "_line"];
|
|
|
|
EXPLODE_3_PVT(_this,_posASL,_direction,_maxDistance);
|
|
|
|
_distance = _maxDistance;
|
|
_interval = _distance;
|
|
_line = [_posASL, []];
|
|
|
|
while {
|
|
_interval > 0.1
|
|
} do {
|
|
_interval = _interval / 2;
|
|
|
|
_line set [1, _posASL vectorAdd (_direction vectorMultiply _distance)];
|
|
|
|
_intersections = {
|
|
_x isKindOf "Static" || {_x isKindOf "AllVehicles"}
|
|
} count (lineIntersectsWith _line);
|
|
|
|
_distance = _distance + ([1, -1] select (_intersections > 0 || {terrainIntersectASL _line})) * _interval;
|
|
|
|
if (_distance > _maxDistance) exitWith {_distance = 999};
|
|
};
|
|
|
|
_distance
|