ACE3/addons/missileguidance/functions/fnc_proNav_onFired.sqf
2021-04-10 18:32:55 -06:00

41 lines
1.5 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Brandon (TCVM)
* Sets up proportional navigation state arrays (called from missileGuidance's onFired).
*
* Arguments:
* Guidance Arg Array <ARRAY>
*
* Return Value:
* None
*
* Example:
* [] call ace_missileguidance_fnc_proNav_onFired
*
* Public: No
*/
params ["_firedEH", "", "", "", "_stateParams"];
_firedEH params ["_shooter","","","","_ammo","","_projectile"];
_launchParams params ["_shooter","_targetLaunchParams","_seekerType","_attackProfile","_lockMode","_laserInfo","_navigationType"];
_targetLaunchParams params ["_target", "_targetPos", "_launchPos"];
_stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState","_navigationParams"];
_seekerParams params ["_seekerAngle", "_seekerAccuracy", "_seekerMaxRange", "_seekerMinRange"];
private _ammoConfig = configOf _projectile;
private _navigationGain = getNumber (_ammoConfig >> QUOTE(ADDON) >> "navigationGain");
if (_navigationGain == 0) then {
_navigationGain = 3;
};
private _pitchYaw = (vectorDir _projectile) call CBA_fnc_vect2Polar;
_navigationParams = [
[ // Last Missile Frame
[0, 0, 0], // Last target position array
[0, 0, 0], // Last target velocity
[0, 0, 0] // Last line of sight
],
[_pitchYaw select 1, 0, _pitchYaw select 2], // current yaw/roll/pitch
_navigationGain // navigation gain of missile. Set in the navigation onFired function
];
_stateParams set [4, _navigationParams];