diff --git a/addons/missileguidance/CfgMissileTypesNato.hpp b/addons/missileguidance/CfgMissileTypesNato.hpp index 83f914043db..b0ebd20b80c 100644 --- a/addons/missileguidance/CfgMissileTypesNato.hpp +++ b/addons/missileguidance/CfgMissileTypesNato.hpp @@ -579,8 +579,8 @@ class GVAR(type_RBS70) { class GVAR(type_Redeye) { enabled = 0; - pitchRate = 27; // Minium flap deflection for guidance - yawRate = 27; // Maximum flap deflection for guidance + pitchRate = 40; // Minium flap deflection for guidance + yawRate = 40; // Maximum flap deflection for guidance canVanillaLock = 1; // Can this default vanilla lock? Only applicable to non-cadet mode @@ -596,6 +596,7 @@ class GVAR(type_Redeye) { defaultNavigationType = "LineOfSight"; navigationTypes[] = { "LineOfSight" }; + navigationGain = 3; seekLastTargetPos = 0; // seek last target position [if seeker loses LOS of target, continue to last known pos] seekerAngle = 45; // Angle from the shooter's view that can track the missile diff --git a/addons/missileguidance/XEH_PREP.hpp b/addons/missileguidance/XEH_PREP.hpp index d92c9528961..3eff31cd82d 100644 --- a/addons/missileguidance/XEH_PREP.hpp +++ b/addons/missileguidance/XEH_PREP.hpp @@ -59,6 +59,7 @@ PREP(mwr_onFired); PREP(IR_onFired); // Navigation OnFired +PREP(los_onFired); PREP(proNav_onFired); PREP(line_onFired); diff --git a/addons/missileguidance/functions/fnc_navigationType_lineOfSight.sqf b/addons/missileguidance/functions/fnc_navigationType_lineOfSight.sqf index 5056d837228..62670e2f960 100644 --- a/addons/missileguidance/functions/fnc_navigationType_lineOfSight.sqf +++ b/addons/missileguidance/functions/fnc_navigationType_lineOfSight.sqf @@ -18,31 +18,29 @@ params ["_args", "_timestep", "_seekerTargetPos", "_profileAdjustedTargetPos"]; _args params ["_firedEH", "", "", "", "_stateParams", "_targetData"]; _firedEH params ["","","","","","","_projectile"]; _stateParams params ["", "", "", "","_navigationParams"]; -_navigationParams params ["_onLaunch"]; -_onLaunch params ["_lastLineOfSight"]; -_targetData params ["_targetDirection", "_attackProfileDirection", "", "_targetVelocity", ""]; +_navigationParams params ["_lastMissileFrame", "_navigationGain"]; +_lastMissileFrame params ["_lastLineOfSight"]; +_targetData params ["_targetDirection", "_attackProfileDirection"]; // Semi-proportional navigation implemented via "Fundamentals of proportional navigation" by Stephen Murtaugh and Harry Criel - -// the los rate is tiny, so we multiply by a constant of a power of ten to get more aggressive acceleration -// this is just due to how we measure our LOS delta, the vectors involved are _tiny_ -private _losDelta = _attackProfileDirection vectorDiff _lastLineOfSight; +private _losDelta = (vectorNormalized _attackProfileDirection) vectorDiff (vectorNormalized _lastLineOfSight); private _losRate = if (_timestep == 0) then { 0 } else { - 10 * (vectorMagnitude _losDelta) / _timestep; + 1 * (vectorMagnitude _losDelta) / _timestep; }; -private _closingVelocity = _targetVelocity vectorDiff (velocity _projectile); +private _lateralAcceleration = _navigationGain * _losRate; +private _commandedAcceleration = _attackProfileDirection vectorMultiply _lateralAcceleration; -private _commandedAcceleration = _closingVelocity vectorMultiply _losRate; +private _missileDirection = vectorNormalized velocity _projectile; // we need acceleration normal to our LOS -private _commandedAccelerationProjected = _attackProfileDirection vectorMultiply (_commandedAcceleration vectorDotProduct _attackProfileDirection); +private _commandedAccelerationProjected = _missileDirection vectorMultiply (_commandedAcceleration vectorDotProduct _missileDirection); _commandedAcceleration = _commandedAcceleration vectorDiff _commandedAccelerationProjected; if (accTime > 0) then { - _navigationParams set [0, [_attackProfileDirection]]; + _navigationParams set [0, [_seekerTargetPos]]; }; -_targetDirection +_commandedAcceleration