diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 814e6575d5..d9813fdf77 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -70,9 +70,11 @@ class CfgAmmo { // Begin ACE guidance Configs class ADDON { enabled = 1; - minDeflection = 0.00005; // Minium flap deflection for guidance - maxDeflection = 0.025; // Maximum flap deflection for guidance - incDeflection = 0.00005; // The incrmeent in which deflection adjusts. + + pitchRate = 100; // degrees per second + yawRate = 100; + stabilityCoefficient = 0.2; + bangBangGuidance = 0; canVanillaLock = 0; @@ -83,6 +85,11 @@ class CfgAmmo { defaultSeekerLockMode = "LOBL"; seekerLockModes[] = { "LOBL" }; + defaultNavigationType = "Direct"; + navigationTypes[] = { "Direct", "ZeroEffortMiss" }; + + navigationGain = 3; + seekerAngle = 180; // Angle in front of the missile which can be searched seekerAccuracy = 1; // seeker accuracy multiplier @@ -95,6 +102,19 @@ class CfgAmmo { defaultAttackProfile = "JAV_TOP"; attackProfiles[] = { "JAV_TOP", "JAV_DIR" }; useModeForAttackProfile = 1; + + class navigationStates { + class initial { + transitionCondition = QFUNC(javelin_midCourseTransition); + navigationType = "Direct"; + }; + class terminal { + transitionCondition = ""; + navigationType = "ZeroEffortMiss"; + }; + // transitions from initial -> termimal + states[] = {"initial", "terminal"}; + }; }; }; class ACE_Javelin_FGM148_static: ACE_Javelin_FGM148 { diff --git a/addons/missileguidance/XEH_PREP.hpp b/addons/missileguidance/XEH_PREP.hpp index d0c6b0af11..daff5b502b 100644 --- a/addons/missileguidance/XEH_PREP.hpp +++ b/addons/missileguidance/XEH_PREP.hpp @@ -32,6 +32,7 @@ PREP(attackProfile_BEAM); // Javelin profiles PREP(attackProfile_JAV_DIR); PREP(attackProfile_JAV_TOP); +PREP(javelin_midCourseTransition); // Navigation Profiles PREP(navigationType_zeroEffortMiss); diff --git a/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf b/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf index b690ab2075..6b06c0dd91 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf @@ -47,7 +47,7 @@ private _returnTargetPos = _seekerTargetPos; switch (_attackProfileStateParams select 0) do { case STAGE_LAUNCH: { TRACE_1("STAGE_LAUNCH",""); - if (_distanceToShooter < 10) then { + if (_distanceToShooter < 6) then { _returnTargetPos = _seekerTargetPos vectorAdd [0,0,_distanceToTarget*2]; } else { _attackProfileStateParams set [0, STAGE_CLIMB]; @@ -55,7 +55,8 @@ switch (_attackProfileStateParams select 0) do { }; case STAGE_CLIMB: { TRACE_1("STAGE_CLIMB",""); - private _cruisAlt = 60 * (_distanceShooterToTarget/2000); + // 65 is min range + private _cruisAlt = 60 * ((0 max (_distanceShooterToTarget - 65))/2000); if ( ((ASLToAGL _projectilePos) select 2) - ((ASLToAGL _seekerTargetPos) select 2) >= _cruisAlt) then { _attackProfileStateParams set [0, STAGE_TERMINAL]; diff --git a/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf b/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf index f1f360e403..347d144914 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf @@ -57,7 +57,7 @@ switch( (_attackProfileStateParams select 0) ) do { TRACE_1("STAGE_CLIMB",""); private _cruisAlt = 140; if (_distanceShooterToTarget < 1250) then { - _cruisAlt = 140 * (_distanceShooterToTarget/1250); + _cruisAlt = 140 * ((0 max (_distanceShooterToTarget - 150))/1250); TRACE_1("_cruisAlt",_cruisAlt); }; if ( ((ASLToAGL _projectilePos) select 2) - ((ASLToAGL _seekerTargetPos) select 2) >= _cruisAlt) then { diff --git a/addons/missileguidance/functions/fnc_javelin_midCourseTransition.sqf b/addons/missileguidance/functions/fnc_javelin_midCourseTransition.sqf new file mode 100644 index 0000000000..ad0eca65cb --- /dev/null +++ b/addons/missileguidance/functions/fnc_javelin_midCourseTransition.sqf @@ -0,0 +1,33 @@ +#include "..\script_component.hpp" +/* + * Author: tcvm + * Condition to switch to next navigation profile + * + * Arguments: + * Guidance Arg Array + * + * Return Value: + * None + * + * Example: + * [] call ace_missileguidance_fnc_javelin_midCourseTransition + * + * Public: No + */ +#define STAGE_LAUNCH 1 +#define STAGE_CLIMB 2 +#define STAGE_COAST 3 +#define STAGE_TERMINAL 4 + +_args params ["_firedEH", "_launchParams", "_flightParams", "_seekerParams", "_stateParams", "_targetData", "_navigationStateData"]; +_firedEH params ["_shooter","","","","_ammo","","_projectile"]; +_launchParams params ["_shooter","_targetLaunchParams","_seekerType","_attackProfile","_lockMode","_laserInfo","_navigationType"]; +_targetLaunchParams params ["_target", "_targetPos", "_launchPos", "_launchDir", "_launchTime"]; +_flightParams params ["_pitchRate", "_yawRate", "_isBangBangGuidance"]; +_stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState","_navigationParams", "_guidanceParameters"]; +_seekerParams params ["_seekerAngle", "_seekerAccuracy", "_seekerMaxRange", "_seekerMinRange"]; +_targetData params ["_targetDirection", "_attackProfileDirection", "_targetRange", "_targetVelocity", "_targetAcceleration"]; + +_attackProfileStateParams params ["_state"]; +_state isEqualTo STAGE_TERMINAL +