1
0
mirror of https://github.com/acemod/ACE3.git synced 2024-08-30 18:23:18 +00:00

SALH: only update seeker pos if it within small error

This commit is contained in:
Brandon Danyluk 2021-04-13 20:51:21 -06:00
parent af2b9a280a
commit 555f0c8921
3 changed files with 12 additions and 2 deletions

@ -25,6 +25,10 @@ private _vectorToTarget = _attackProfileDirection vectorMultiply _targetRange;
private _closingVelocity = _targetVelocity vectorDiff velocity _projectile;
private _timeToGo = _targetRange / vectorMagnitude _closingVelocity;
if (_timeToGo == 0) then {
_timeToGo = 0.001;
};
private _zeroEffortMiss = _vectorToTarget vectorAdd (_closingVelocity vectorMultiply _timeToGo);
private _zeroEffortMissProjectiled = _attackProfileDirection vectorMultiply (_zeroEffortMiss vectorDotProduct _attackProfileDirection);
private _zeroEffortMissNormal = _zeroEffortMiss vectorDiff _zeroEffortMissProjectiled;

@ -17,6 +17,7 @@
* Public: No
*/
#define MAX_AVERAGES 15
#define MINIMUM_DISTANCE_UNTIL_NEW_POS 1
params ["", "_args", "", "", "_timestep"];
_args params ["_firedEH", "_launchParams", "", "_seekerParams", "", "_targetData"];
@ -49,6 +50,12 @@ private _aproximateVelocity = [0, 0, 0];
_positionSum = _positionSum vectorAdd _foundTargetPos;
if (MAX_AVERAGES == count _lastPositions) then {
_positionSum = _positionSum vectorMultiply (1 / (1 + count _lastPositions));
// if we are within a meter of the previous average, just use the previous average
if (_positionSum distanceSqr _lastPositionSum < MINIMUM_DISTANCE_UNTIL_NEW_POS * MINIMUM_DISTANCE_UNTIL_NEW_POS) then {
_positionSum = _lastPositionSum;
};
if (_timestep != 0) then {
_aproximateVelocity = (_positionSum vectorDiff _lastPositionSum) vectorMultiply (1 / _timestep);
};

@ -37,7 +37,7 @@ Seeker Types:
Navigation Types:
X GBU-12 - LOS Guidance
X NLAW - LOS Guidance
X Dragon - NA
Metis - Wire/Beam Guidance
@ -57,7 +57,6 @@ Navigation Types:
R-77 - ZEM
AIM-120 - ZEM
AIM-132 - ZEM
KH-25 - Pro Nav
GBU-SDB - ZEM
Navigation State Machine: