From 71e01a2ee497684864673204d4a729aec288622a Mon Sep 17 00:00:00 2001 From: Bailey Danyluk Date: Mon, 4 Apr 2022 18:46:40 -0600 Subject: [PATCH] Update all Line guidance missiles --- addons/hot/CfgAmmo.hpp | 5 ++- addons/metis/CfgAmmo.hpp | 5 ++- .../functions/fnc_navigationType_line.sqf | 34 +++++++++---------- addons/sdb/CfgAmmo.hpp | 2 +- addons/vikhr/CfgAmmo.hpp | 5 ++- 5 files changed, 23 insertions(+), 28 deletions(-) diff --git a/addons/hot/CfgAmmo.hpp b/addons/hot/CfgAmmo.hpp index 7905d23881..0b76370754 100644 --- a/addons/hot/CfgAmmo.hpp +++ b/addons/hot/CfgAmmo.hpp @@ -75,8 +75,8 @@ class CfgAmmo { defaultNavigationType = "Line"; navigationTypes[] = { "Line" }; - lineGainP = 35; - lineGainD = 30; + lineGainP = 7; + lineGainD = 6; initialPitch = 2; @@ -87,7 +87,6 @@ class CfgAmmo { seekerMinRange = 75; seekerMaxRange = 4000; // Range from the missile which the seeker can visually search - correctionDistance = 30; // distance from center of crosshair where missile slows down offsetFromCrosshair[] = { 0, 0, 0.5 }; // where the missile wants to stay in relation to the center of the crosshair. // Attack profile type selection diff --git a/addons/metis/CfgAmmo.hpp b/addons/metis/CfgAmmo.hpp index 98814f1034..c070343253 100644 --- a/addons/metis/CfgAmmo.hpp +++ b/addons/metis/CfgAmmo.hpp @@ -28,8 +28,8 @@ class CfgAmmo { defaultNavigationType = "Line"; navigationTypes[] = { "Line" }; - lineGainP = 30; - lineGainD = 30; + lineGainP = 10; + lineGainD = 9; 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 @@ -38,7 +38,6 @@ 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 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_navigationType_line.sqf b/addons/missileguidance/functions/fnc_navigationType_line.sqf index 9173d6eff1..8a9cef6744 100644 --- a/addons/missileguidance/functions/fnc_navigationType_line.sqf +++ b/addons/missileguidance/functions/fnc_navigationType_line.sqf @@ -20,26 +20,24 @@ _targetData params ["", "_targetDir", "_distance"]; _flightParams params ["_pitchRate", "_yawRate"]; _navigationParams params ["_proportionalGain", "", "_derivativeGain", "_lastErrorX", "_lastErrorY", "_correctionDistance"]; -private _targetDistance = _projectile vectorWorldToModelVisual (_targetDir vectorMultiply _distance); +private _relativeTargetDirection = [0, (velocityModelSpace _projectile) select 1, 0] vectorAdd (_projectile vectorWorldToModelVisual (_targetDir vectorMultiply _distance)); -//_proportionalGain = 30; -//_derivativeGain = 30; -//_correctionDistance = 3; -private _errorX = _targetDistance#0 / _correctionDistance; -private _errorY = _targetDistance#2 / _correctionDistance; +_proportionalGain = 50; +_derivativeGain = 0; -private _pX = _proportionalGain * _errorX; -private _dX = if (_timestep != 0) then { - _derivativeGain * (_errorX - _lastErrorX) / _timestep -} else { - 0 +private _angleX = ((_relativeTargetDirection select 0) atan2 (_relativeTargetDirection select 1)); +private _angleY = ((_relativeTargetDirection select 2) atan2 (_relativeTargetDirection select 1)); + +private _pX = _proportionalGain * _angleX; +private _dX = 0; +if (_timestep > 0) then { + _dX = _derivativeGain * (_angleX - _lastErrorX) / _timestep; }; -private _pY = _proportionalGain * _errorY; -private _dY = if (_timestep != 0) then { - _derivativeGain * (_errorY - _lastErrorY) / _timestep -} else { - 0 +private _pY = _proportionalGain * _angleY; +private _dY = 0; +if (_timestep > 0) then { + _dY = _derivativeGain * (_angleY - _lastErrorY) / _timestep; }; private _accelerationX = _pX + _dX; @@ -51,7 +49,7 @@ private _commandedAcceleration = [ _accelerationY ]; -_navigationParams set [3, _errorX]; -_navigationParams set [4, _errorY]; +_navigationParams set [3, _angleX]; +_navigationParams set [4, _angleY]; _projectile vectorModelToWorldVisual _commandedAcceleration; diff --git a/addons/sdb/CfgAmmo.hpp b/addons/sdb/CfgAmmo.hpp index 2550f29fd2..824da78c27 100644 --- a/addons/sdb/CfgAmmo.hpp +++ b/addons/sdb/CfgAmmo.hpp @@ -22,7 +22,7 @@ class CfgAmmo { navigationTypes[] = { "LINE" }; lineGainP = 50; - lineGainD = 1; + lineGainD = 0; seekLastTargetPos = 0; // seek last target position [if seeker loses LOS of target, continue to last known pos] seekerAngle = 60; // Angle from the shooter's view that can track the missile diff --git a/addons/vikhr/CfgAmmo.hpp b/addons/vikhr/CfgAmmo.hpp index f24a85fbb8..39cb2ee266 100644 --- a/addons/vikhr/CfgAmmo.hpp +++ b/addons/vikhr/CfgAmmo.hpp @@ -27,9 +27,8 @@ class CfgAmmo { defaultNavigationType = "Line"; navigationTypes[] = { "Line" }; - lineGainP = 40; - lineGainD = 30; - correctionDistance = 5; + lineGainP = 8; + lineGainD = 6; 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