2015-03-09 15:46:59 +00:00
|
|
|
/*
|
|
|
|
* Author: PabstMirror
|
2015-03-11 07:06:07 +00:00
|
|
|
* Recieves the data packet from the vector rangefinder
|
2015-03-09 15:46:59 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-03-11 07:06:07 +00:00
|
|
|
* 0: Slope distance (Meters) <NUMBER>
|
|
|
|
* 1: Azimuth (Degrees) <NUMBER>
|
|
|
|
* 2: Inclination (Degrees) <NUMBER>
|
2015-03-09 15:46:59 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-03-11 07:06:07 +00:00
|
|
|
* Nothing
|
2015-03-09 15:46:59 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2015-03-11 07:06:07 +00:00
|
|
|
* [1000, 45, 1] call ace_microdagr_fnc_recieveRangefinderData
|
2015-03-09 15:46:59 +00:00
|
|
|
*
|
2015-03-11 07:06:07 +00:00
|
|
|
* Public: No
|
2015-03-09 15:46:59 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-03-11 07:06:07 +00:00
|
|
|
private ["_horizontalDistance", "_verticleDistance", "_targetOffset", "_targetPosASL"];
|
|
|
|
|
2015-03-09 15:46:59 +00:00
|
|
|
PARAMS_3(_slopeDistance,_azimuth,_inclination);
|
|
|
|
|
|
|
|
if (GVAR(currentWaypoint) != -2) exitWith {}; //Only take waypoint when "connected"
|
|
|
|
if (_slopeDistance < 0) exitWith {}; //Bad Data
|
|
|
|
|
|
|
|
_horizontalDistance = (cos _inclination) * _slopeDistance;
|
|
|
|
_verticleDistance = (sin _inclination) * _slopeDistance;
|
|
|
|
|
|
|
|
_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
|
|
|
|
_targetPosASL = (getPosASL ace_player) vectorAdd _targetOffset;
|
|
|
|
|
|
|
|
GVAR(rangeFinderPositionASL) = _targetPosASL;
|