From cf40622b52e449179a1ade7c5e4555ba937491de Mon Sep 17 00:00:00 2001 From: Brandon Danyluk Date: Mon, 12 Apr 2021 00:12:16 -0600 Subject: [PATCH] Fix metis and HOT to use new scheme --- addons/dragon/CfgAmmo.hpp | 8 +++++--- addons/hot/CfgAmmo.hpp | 8 +++++--- addons/metis/CfgAmmo.hpp | 18 +++++++++++------- .../functions/fnc_guidancePFH.sqf | 11 +++++------ .../fnc_navigationType_lineOfSight.sqf | 2 +- .../functions/fnc_navigationType_proNav.sqf | 2 +- .../missileguidance/functions/fnc_onFired.sqf | 3 ++- .../functions/fnc_proNav_onFired.sqf | 2 -- addons/missileguidance/todo.txt | 2 +- 9 files changed, 31 insertions(+), 25 deletions(-) diff --git a/addons/dragon/CfgAmmo.hpp b/addons/dragon/CfgAmmo.hpp index 033239013f..929ba6f14c 100644 --- a/addons/dragon/CfgAmmo.hpp +++ b/addons/dragon/CfgAmmo.hpp @@ -36,9 +36,8 @@ class CfgAmmo { maxControlRange = 1500; class ace_missileguidance { - minDeflection = 0; - maxDeflection = 0; - incDeflection = 0; + pitchRate = 0; + yawRate = 0; canVanillaLock = 0; @@ -49,6 +48,9 @@ class CfgAmmo { defaultSeekerLockMode = "LOAL"; seekerLockModes[] = { "LOAL", "LOBL" }; + defaultNavigationType = "LineOfSight"; + navigationTypes[] = { "LineOfSight" }; + seekLastTargetPos = 0; seekerAngle = 30; seekerAccuracy = 1; diff --git a/addons/hot/CfgAmmo.hpp b/addons/hot/CfgAmmo.hpp index 4ee29bec6d..1c90d42f32 100644 --- a/addons/hot/CfgAmmo.hpp +++ b/addons/hot/CfgAmmo.hpp @@ -57,9 +57,8 @@ class CfgAmmo { class ace_missileguidance { enabled = 1; - minDeflection = 0; // Minium flap deflection for guidance - maxDeflection = 0.0030; // Maximum flap deflection for guidance - incDeflection = 0.0005; // The incrmeent in which deflection adjusts. + pitchRate = 15; // Minium flap deflection for guidance + yawRate = 15; // Maximum flap deflection for guidance canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode @@ -70,6 +69,9 @@ class CfgAmmo { defaultSeekerLockMode = "LOAL"; seekerLockModes[] = { "LOAL", "LOBL" }; + defaultNavigationType = "LineOfSight"; + navigationTypes[] = { "LineOfSight" }; + seekLastTargetPos = 0; // seek last target position [if seeker loses LOS of target, continue to last known pos] seekerAngle = 30; // Angle from the shooter's view that can track the missile seekerAccuracy = 1; // seeker accuracy multiplier diff --git a/addons/metis/CfgAmmo.hpp b/addons/metis/CfgAmmo.hpp index 1f613a36b1..a4ff69c5e7 100644 --- a/addons/metis/CfgAmmo.hpp +++ b/addons/metis/CfgAmmo.hpp @@ -10,9 +10,8 @@ class CfgAmmo { class ace_missileguidance { enabled = 1; - minDeflection = 0; // Minium flap deflection for guidance - maxDeflection = 0.0027; // Maximum flap deflection for guidance - incDeflection = 0.0005; // The incrmeent in which deflection adjusts. + pitchRate = 25; // Minium flap deflection for guidance + yawRate = 25; // Maximum flap deflection for guidance canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode @@ -23,6 +22,9 @@ class CfgAmmo { defaultSeekerLockMode = "LOAL"; seekerLockModes[] = { "LOAL", "LOBL" }; + defaultNavigationType = "LineOfSight"; + navigationTypes[] = { "LineOfSight" }; + seekLastTargetPos = 0; // seek last target position [if seeker loses LOS of target, continue to last known pos] seekerAngle = 15; // Angle from the shooter's view that can track the missile seekerAccuracy = 1; // seeker accuracy multiplier @@ -50,9 +52,8 @@ class CfgAmmo { class ace_missileguidance { enabled = 1; - minDeflection = 0; // Minium flap deflection for guidance - maxDeflection = 0.0027; // Maximum flap deflection for guidance - incDeflection = 0.0005; // The incrmeent in which deflection adjusts. + pitchRate = 25; // Minium flap deflection for guidance + yawRate = 25; // Maximum flap deflection for guidance canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode @@ -63,6 +64,9 @@ class CfgAmmo { defaultSeekerLockMode = "LOAL"; seekerLockModes[] = { "LOAL", "LOBL" }; + defaultNavigationType = "LineOfSight"; + navigationTypes[] = { "LineOfSight" }; + seekLastTargetPos = 0; // seek last target position [if seeker loses LOS of target, continue to last known pos] seekerAngle = 15; // Angle from the shooter's view that can track the missile seekerAccuracy = 1; // seeker accuracy multiplier @@ -70,7 +74,7 @@ class CfgAmmo { seekerMinRange = 80; seekerMaxRange = 2000; // Range from the missile which the seeker can visually search - correctionDistance = 3; // distance from center of crosshair where missile slows down + correctionDistance = 6; // distance from center of crosshair where missile slows down offsetFromCrosshair[] = { 0, 0, 0 }; // where the missile wants to stay in relation to the center of the crosshair. // Attack profile type selection diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index 54df4e6946..43c38ab64f 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -24,7 +24,7 @@ params ["_args", "_pfID"]; _args params ["_firedEH", "_launchParams", "_flightParams", "_seekerParams", "_stateParams"]; _firedEH params ["_shooter","","","","_ammo","","_projectile"]; _launchParams params ["","_targetLaunchParams","","","","","_navigationType"]; -_stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState", "_navigationParameters"]; +_stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState", "_navigationParameters", "_guidanceParameters"]; if (!alive _projectile || isNull _projectile || isNull _shooter) exitWith { [_pfID] call CBA_fnc_removePerFrameHandler; @@ -55,8 +55,7 @@ if ((_pitchRate != 0 || {_yawRate != 0}) && {_profileAdjustedTargetPos isNotEqua // activate missile servos and change direction if (!isGamePaused && accTime > 0) then { - _navigationParameters params ["", "_currentPitchYawRoll"]; - _currentPitchYawRoll params ["_yaw", "_roll", "_pitch"]; + _guidanceParameters params ["_yaw", "_roll", "_pitch"]; _commandedAcceleration = _projectile vectorWorldToModelVisual _commandedAcceleration; _commandedAcceleration params ["_yawChange", "", "_pitchChange"]; @@ -90,10 +89,10 @@ if ((_pitchRate != 0 || {_yawRate != 0}) && {_profileAdjustedTargetPos isNotEqua [_projectile, _pitch, _yaw, 0] call FUNC(changeMissileDirection); _projectile setVelocityModelSpace [0, vectorMagnitude velocity _projectile, 0]; - _currentPitchYawRoll set [0, _yaw]; - _currentPitchYawRoll set [2, _pitch]; + _guidanceParameters set [0, _yaw]; + _guidanceParameters set [2, _pitch]; - _navigationParameters set [1, _currentPitchYawRoll]; + _stateParams set [5, _guidanceParameters]; }; _stateParams set [4, _navigationParameters]; diff --git a/addons/missileguidance/functions/fnc_navigationType_lineOfSight.sqf b/addons/missileguidance/functions/fnc_navigationType_lineOfSight.sqf index fb6a8b1222..f5adcb718e 100644 --- a/addons/missileguidance/functions/fnc_navigationType_lineOfSight.sqf +++ b/addons/missileguidance/functions/fnc_navigationType_lineOfSight.sqf @@ -19,4 +19,4 @@ _args params ["_firedEH"]; _firedEH params ["","","","","","","_projectile"]; private _lineOfSight = vectorNormalized (_profileAdjustedTargetPos vectorDiff getPosASLVisual _projectile); -_lineOfSight +_lineOfSight vectorMultiply 50 diff --git a/addons/missileguidance/functions/fnc_navigationType_proNav.sqf b/addons/missileguidance/functions/fnc_navigationType_proNav.sqf index 9d4272ff1f..7d5c6a3d6e 100644 --- a/addons/missileguidance/functions/fnc_navigationType_proNav.sqf +++ b/addons/missileguidance/functions/fnc_navigationType_proNav.sqf @@ -18,7 +18,7 @@ params ["_args", "_timestep", "_seekerTargetPos", "_profileAdjustedTargetPos"]; _args params ["_firedEH", "", "", "", "_stateParams"]; _firedEH params ["","","","","","","_projectile"]; _stateParams params ["", "", "", "","_navigationParams"]; -_navigationParams params ["_lastMissileFrame", "", "_navigationGain"]; +_navigationParams params ["_lastMissileFrame", "_navigationGain"]; _lastMissileFrame params ["_lastTargetPosition", "_lastTargetVelocity", "_lastLineOfSight"]; // Proportional navigation implemented via "Fundamentals of proportional navigation" by Stephen Murtaugh and Harry Criel diff --git a/addons/missileguidance/functions/fnc_onFired.sqf b/addons/missileguidance/functions/fnc_onFired.sqf index 81ef1ed1a3..4e28c1e8e4 100644 --- a/addons/missileguidance/functions/fnc_onFired.sqf +++ b/addons/missileguidance/functions/fnc_onFired.sqf @@ -118,6 +118,7 @@ if (isNumber (_config >> "pitchRate")) then { _bangBang = 1 == getNumber (_config >> "bangBangGuidance"); }; +private _pitchYaw = (vectorDir _projectile) call CBA_fnc_vect2Polar; TRACE_5("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile,_navigationType); private _args = [_this, [ _shooter, @@ -139,7 +140,7 @@ private _args = [_this, getNumber ( _config >> "seekerMaxRange" ), getNumber ( _config >> "seekerMinRange" ) ], - [ diag_tickTime, [], [], _lastKnownPosState, _navigationParameters] + [ diag_tickTime, [], [], _lastKnownPosState, _navigationParameters, [_pitchYaw select 1, 0, _pitchYaw select 2]] ]; private _onFiredFunc = getText (configFile >> QGVAR(SeekerTypes) >> _seekerType >> "onFired"); diff --git a/addons/missileguidance/functions/fnc_proNav_onFired.sqf b/addons/missileguidance/functions/fnc_proNav_onFired.sqf index 844a9d9284..d1806c1907 100644 --- a/addons/missileguidance/functions/fnc_proNav_onFired.sqf +++ b/addons/missileguidance/functions/fnc_proNav_onFired.sqf @@ -27,14 +27,12 @@ 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]; diff --git a/addons/missileguidance/todo.txt b/addons/missileguidance/todo.txt index 896c891634..5b1de564c6 100644 --- a/addons/missileguidance/todo.txt +++ b/addons/missileguidance/todo.txt @@ -15,7 +15,7 @@ Seeker Types: Laser - causes lots of weapon noise, causing bad guidance Navigation Types: - GBU-12 - LOS Guidance + GBU-12 - Simple ProNav Guidance NLAW - LOS Guidance Dragon - LOS Guidance Metis - LOS Guidance