ACE3/addons/microdagr/functions/fnc_recieveRangefinderData.sqf
Dedmen Miller 81e02a7336 Refactor private ARRAY to private keyword (#5598)
* Everything

* Fixed missing ;

* Fix missing ; and double private

* Fixed cannot isNull on number

* Turn _temparture back to isNil

* Fix error from merge
2017-10-10 09:39:59 -05:00

32 lines
1.0 KiB
Plaintext

/*
* Author: PabstMirror
* Recieves the data packet from the vector rangefinder
*
* Arguments:
* 0: Slope distance (Meters) <NUMBER>
* 1: Azimuth (Degrees) <NUMBER>
* 2: Inclination (Degrees) <NUMBER>
*
* Return Value:
* None
*
* Example:
* [1000, 45, 1] call ace_microdagr_fnc_recieveRangefinderData
*
* Public: No
*/
#include "script_component.hpp"
params ["_slopeDistance", "_azimuth", "_inclination"];
if (GVAR(currentWaypoint) != -2) exitWith {}; //Only take waypoint when "connected"
if (_slopeDistance < 0) exitWith {}; //Bad Data
private _horizontalDistance = (cos _inclination) * _slopeDistance;
private _verticleDistance = (sin _inclination) * _slopeDistance;
private _targetOffset = [((sin _azimuth) * _horizontalDistance), ((cos _azimuth) * _horizontalDistance), _verticleDistance];
//This assumes the "rangefinder view" pos is very close to player, at worst the turret should only be a few meters different
private _targetPosASL = (getPosASL ACE_player) vectorAdd _targetOffset;
GVAR(rangeFinderPositionASL) = _targetPosASL;