ACE3/addons/common/functions/fnc_getTurretDirection.sqf
Nicolás Badano ab6fc8efca Laser guidance for all designators (#3308)
* Fix laser and missileguidance over water

* Return a normalized vector in EFUNC(common,getTurretDirection)

* Make laser dispersion simulation optional, default off

* Prototype for ace_laser_designate

* Remove vanilla laser handling from ace_laser in favor of the new code on ace_laser_designate

* Simplify laser into one module

Rewrite large parts of laser
Merge laser_designate
Delete lase_selfDesignate

* Cleanup missile guidance

* Headers, fix laser over water

* Cleanup

* Test

* Change setting to scalar, more cleanup

* Add seeker debug drawing
2016-10-08 12:55:30 +02:00

43 lines
1.3 KiB
Plaintext

/*
* Author: jaynus
* Get the absolute turret direction for FOV/PIP turret.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Turret Position <ARRAY>
*
* Return Value:
* 0: Position ASL <ARRAY>
* 1: Direction <ARRAY>
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_vehicle", "_position"];
private _turret = [_vehicle, _position] call CBA_fnc_getTurret;
private _pov = getText (_turret >> "memoryPointGunnerOptics");
private _gunBeg = getText (_turret >> "gunBeg");
private _gunEnd = getText (_turret >> "gunEnd");
TRACE_3("", _pov, _gunBeg, _gunEnd);
// Pull the PIP pov or barrel direction, depending on how the model is set up
private _povPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _pov)); //@todo AGLToASL ?
private _povDir = [0,0,0];
if (_pov == "pip0_pos") then {
private _pipDir = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir"));
_povDir = _pipDir vectorDiff _povPos;
} else {
private _gunBeginPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg));
private _gunEndPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd));
_povDir = _gunBeginPos vectorDiff _gunEndPos;
};
_povDir = vectorNormalized _povDir;
[_povPos, _povDir]