Fix NLAW guidance that was causing massive overfly

This commit is contained in:
Bailey 2023-01-20 18:55:39 -07:00
parent 0957a3356f
commit 01ac87da34
3 changed files with 12 additions and 3 deletions

View File

@ -20,7 +20,7 @@ params ["_args", "_timestep", "_seekerTargetPos", "_profileAdjustedTargetPos", "
_args params ["_firedEH"];
_firedEH params ["","","","","","","_projectile"];
_navigationParams params ["_yawChange", "_pitchChange", "_lastPitch", "_lastYaw"];
_navigationParams params ["_yawChange", "_pitchChange", "_lastPitch", "_lastYaw", "_initialPitch"];
// for some reason we need to double this. I don't know why, but it just works
_pitchChange = _pitchChange * 2;
@ -41,6 +41,7 @@ private _pitchModifier = if (_pitchChange == 0) then {
abs (_pitchRate / _pitchChange)
};
private _desiredPitchChange = (_pitchChange - _pitchRate) * PROPORTIONALITY_CONSTANT * _pitchModifier;
_desiredPitchChange = _desiredPitchChange + (_initialPitch - _currentPitch) * PROPORTIONALITY_CONSTANT * _pitchModifier;
private _yawRate = if (_timestep == 0) then {
0

View File

@ -56,11 +56,14 @@ _yawChange = -10 max _yawChange min 10;
_pitchChange = -10 max _pitchChange min 10;
((velocity _projectile) call CBA_fnc_vect2polar) params ["", "_currentYaw", "_currentPitch"];
((ACE_player weaponDirection (currentWeapon ACE_player)) call CBA_fnc_vect2Polar) params ["", "_yaw", "_pitch"];
TRACE_5("attackProfileStateParams",_firedLOS,_yawChange,_pitchChange,_currentPitch,_currentYaw);
_navigationParams set [0, _yawChange];
_navigationParams set [1, _pitchChange];
_navigationParams set [2, _currentPitch]; // last pitch
_navigationParams set [3, _currentYaw]; // last yaw
_navigationParams set [4, _pitch]; // initial pitch
_navigationParams set [5, 0]; // whether or not to zero out the pitch
_navigationParams

View File

@ -16,6 +16,7 @@
*
* Public: No
*/
#define PITCH_UP_TIME 1
params ["", "_args", "_seekerStateParams", "", "", "_targetData"];
_args params ["_firedEH", "_launchParams", "", "_seekerParams", "_stateParams"];
@ -24,14 +25,18 @@ _launchParams params ["", "_targetLaunchParams", "", "_attackProfile"];
_targetLaunchParams params ["", "", "_launchPos"];
_stateParams params ["", "", "", "", "_navigationParams"];
if (_attackProfile == QGVAR(directAttack)) exitWith {[0,0,0]};
if (_attackProfile == QGVAR(directAttack)) exitWith {
_navigationParams set [5, 1];
[0,0,0]
};
_seekerStateParams params ["", "", "", "_originalPitchRate", "_startTime"];
_navigationParams params ["", "_pitchRate"];
// pitch up for the first second of flight to begin an over-fly trajectory
private _pitchChange = linearConversion [0, 1, CBA_missionTime - _startTime, 1, 0, true];
private _pitchChange = linearConversion [0, PITCH_UP_TIME, CBA_missionTime - _startTime, 2, 0, true];
_navigationParams set [1, _originalPitchRate + _pitchChange];
_navigationParams set [5, (CBA_missionTime - _startTime) min PITCH_UP_TIME];
private _projPos = getPosASL _projectile;