2015-04-02 17:05:50 +00:00
|
|
|
/*
|
|
|
|
* Author: jaynus
|
|
|
|
* Get the absolute turret direction for FOV/PIP turret.
|
|
|
|
*
|
2015-09-20 21:40:51 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Vehicle <OBJECT>
|
|
|
|
* 1: Turret Position <ARRAY>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* 0: Position ASL <ARRAY>
|
|
|
|
* 1: Direction <ARRAY>
|
2015-04-02 17:05:50 +00:00
|
|
|
*
|
2015-09-20 21:40:51 +00:00
|
|
|
* Public: Yes
|
2015-04-02 17:05:50 +00:00
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-09-20 21:40:51 +00:00
|
|
|
params ["_vehicle", "_position"];
|
|
|
|
|
|
|
|
private ["_turret", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir"];
|
2015-04-02 17:05:50 +00:00
|
|
|
|
|
|
|
_turret = [_vehicle, _position] call CBA_fnc_getTurret;
|
2015-09-20 21:40:51 +00:00
|
|
|
|
2015-04-02 17:05:50 +00:00
|
|
|
_pov = getText (_turret >> "memoryPointGunnerOptics");
|
|
|
|
_gunBeg = getText (_turret >> "gunBeg");
|
2015-09-20 21:40:51 +00:00
|
|
|
_gunEnd = getText (_turret >> "gunEnd");
|
|
|
|
|
2015-04-02 17:05:50 +00:00
|
|
|
TRACE_3("", _pov, _gunBeg, _gunEnd);
|
|
|
|
|
|
|
|
// Pull the PIP pov or barrel direction, depending on how the model is set up
|
2015-09-20 21:40:51 +00:00
|
|
|
_povPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _pov)); //@todo AGLToASL ?
|
2015-04-02 17:05:50 +00:00
|
|
|
_povDir = [0,0,0];
|
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
if (_pov == "pip0_pos") then {
|
2015-09-20 21:40:51 +00:00
|
|
|
private "_pipDir";
|
|
|
|
_pipDir = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir"));
|
|
|
|
|
2015-04-03 22:26:27 +00:00
|
|
|
_povDir = _pipDir vectorDiff _povPos;
|
2015-04-02 17:05:50 +00:00
|
|
|
} else {
|
2015-09-20 21:40:51 +00:00
|
|
|
private ["_gunBeginPos", "_gunEndPos"];
|
|
|
|
|
|
|
|
_gunBeginPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg));
|
|
|
|
_gunEndPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd));
|
|
|
|
|
2015-04-03 22:26:27 +00:00
|
|
|
_povDir = _gunBeginPos vectorDiff _gunEndPos;
|
2015-04-02 17:05:50 +00:00
|
|
|
};
|
|
|
|
|
2015-09-20 21:40:51 +00:00
|
|
|
[_povPos, _povDir]
|