multiple changes

This commit is contained in:
Brandon Danyluk 2021-04-13 20:31:10 -06:00
parent a2d2dd0df9
commit af2b9a280a
6 changed files with 22 additions and 25 deletions

View File

@ -68,8 +68,8 @@ class CfgAmmo {
seekerMaxRange = 4000; // Range from the missile which the seeker can visually search seekerMaxRange = 4000; // Range from the missile which the seeker can visually search
// Attack profile type selection // Attack profile type selection
defaultAttackProfile = "LIN"; defaultAttackProfile = "DIR";
attackProfiles[] = {"LIN"}; attackProfiles[] = {"DIR"};
}; };
}; };
}; };

View File

@ -48,16 +48,5 @@ if (_seekerTargetPos isEqualTo [0, 0, 0] || { _distanceToProjectile < _seekerMin
_projectilePos vectorAdd (_projectile vectorModelToWorld [0, 50, 0]) _projectilePos vectorAdd (_projectile vectorModelToWorld [0, 50, 0])
}; };
private _relativeCorrection = _projectile vectorWorldToModel (_projectilePos vectorDiff _seekerTargetPos); _seekerTargetPos vectorAdd (_shooterDir vectorMultiply 30);
_relativeCorrection = _relativeCorrection vectorDiff _crosshairOffset;
private _magnitude = vectorMagnitude [_relativeCorrection select 0, 0, _relativeCorrection select 2];
private _fovImpulse = 1 min (_magnitude / _maxCorrectableDistance); // the simulated impulse for the missile being close to the center of the crosshair
// Adjust the impulse due to near-zero values creating wobbly missiles?
private _correction = _fovImpulse;
_relativeCorrection = (vectorNormalized _relativeCorrection) vectorMultiply _correction;
private _returnPos = _projectilePos vectorDiff (_projectile vectorModelToWorld _relativeCorrection);
_returnPos vectorAdd (_shooterDir vectorMultiply _distanceAheadOfMissile)

View File

@ -34,10 +34,10 @@ private _timestep = diag_deltaTime * accTime;
_flightParams params ["_pitchRate", "_yawRate", "_isBangBangGuidance"]; _flightParams params ["_pitchRate", "_yawRate", "_isBangBangGuidance"];
// Run seeker function: // Run seeker function:
private _seekerTargetPos = [[0,0,0], _args, _seekerStateParams, _lastKnownPosState] call FUNC(doSeekerSearch); private _seekerTargetPos = [[0,0,0], _args, _seekerStateParams, _lastKnownPosState, _timestep] call FUNC(doSeekerSearch);
// Run attack profile function: // Run attack profile function:
_seekerTargetPos = AGLtoASL ASLToAGL _seekerTargetPos; _seekerTargetPos = AGLtoASL ASLToAGL _seekerTargetPos;
private _profileAdjustedTargetPos = [_seekerTargetPos, _args, _attackProfileStateParams] call FUNC(doAttackProfile); private _profileAdjustedTargetPos = [_seekerTargetPos, _args, _attackProfileStateParams, _timestep] call FUNC(doAttackProfile);
private _projectilePos = getPosASLVisual _projectile; private _projectilePos = getPosASLVisual _projectile;
_targetData set [1, _projectilePos vectorFromTo _profileAdjustedTargetPos]; _targetData set [1, _projectilePos vectorFromTo _profileAdjustedTargetPos];

View File

@ -25,7 +25,7 @@ _seekerParams params ["_seekerAngle", "", "_seekerMaxRange"];
if (isNil "_target") exitWith {[0,0,0]}; if (isNil "_target") exitWith {[0,0,0]};
private _foundTargetPos = aimPos _target; private _foundTargetPos = _target modelToWorldVisualWorld getCenterOfMass _target;
// @TODO: This is seeker LOS and angle checks for LOAL only; LOBL does not need visual // @TODO: This is seeker LOS and angle checks for LOAL only; LOBL does not need visual
private _angleOkay = [_projectile, _foundTargetPos, _seekerAngle] call FUNC(checkSeekerAngle); private _angleOkay = [_projectile, _foundTargetPos, _seekerAngle] call FUNC(checkSeekerAngle);
@ -40,9 +40,7 @@ TRACE_2("", _angleOkay, _losOkay);
if (!_angleOkay || !_losOkay) exitWith {[0,0,0]}; if (!_angleOkay || !_losOkay) exitWith {[0,0,0]};
TRACE_2("", _target, _foundTargetPos); TRACE_2("", _target, _foundTargetPos);
private _projectileSpeed = (vectorMagnitude velocity _projectile);
private _distanceToTarget = (getPosASL _projectile) vectorDistance _foundTargetPos; private _distanceToTarget = (getPosASL _projectile) vectorDistance _foundTargetPos;
private _eta = _distanceToTarget / _projectileSpeed;
_targetData set [0, (getPosASL _projectile) vectorFromTo _foundTargetPos]; _targetData set [0, (getPosASL _projectile) vectorFromTo _foundTargetPos];
_targetData set [2, _distanceToTarget]; _targetData set [2, _distanceToTarget];

View File

@ -18,11 +18,11 @@
*/ */
#define MAX_AVERAGES 15 #define MAX_AVERAGES 15
params ["", "_args"]; params ["", "_args", "", "", "_timestep"];
_args params ["_firedEH", "_launchParams", "", "_seekerParams", "", "_targetData"]; _args params ["_firedEH", "_launchParams", "", "_seekerParams", "", "_targetData"];
_firedEH params ["","","","","","","_projectile"]; _firedEH params ["","","","","","","_projectile"];
_launchParams params ["","","","","","_laserParams"]; _launchParams params ["","","","","","_laserParams"];
_seekerParams params ["_seekerAngle", "", "_seekerMaxRange", "", ["_lastPositions", []], ["_lastPositionIndex", 0]]; _seekerParams params ["_seekerAngle", "", "_seekerMaxRange", "", ["_lastPositions", []], ["_lastPositionIndex", 0], ["_lastPositionSum", [0, 0, 0]]];
_laserParams params ["_code", "_wavelengthMin", "_wavelengthMax"]; _laserParams params ["_code", "_wavelengthMin", "_wavelengthMax"];
private _laserResult = [(getPosASL _projectile), (velocity _projectile), _seekerAngle, _seekerMaxRange, [_wavelengthMin, _wavelengthMax], _code, _projectile] call EFUNC(laser,seekerFindLaserSpot); private _laserResult = [(getPosASL _projectile), (velocity _projectile), _seekerAngle, _seekerMaxRange, [_wavelengthMin, _wavelengthMax], _code, _projectile] call EFUNC(laser,seekerFindLaserSpot);
@ -45,14 +45,21 @@ if (_foundTargetPos isNotEqualTo [0, 0, 0]) then {
_seekerParams set [5, _lastPositionIndex + 1]; _seekerParams set [5, _lastPositionIndex + 1];
}; };
private _aproximateVelocity = [0, 0, 0];
_positionSum = _positionSum vectorAdd _foundTargetPos; _positionSum = _positionSum vectorAdd _foundTargetPos;
if (MAX_AVERAGES == count _lastPositions) then { if (MAX_AVERAGES == count _lastPositions) then {
_positionSum = _positionSum vectorMultiply (1 / (1 + count _lastPositions)); _positionSum = _positionSum vectorMultiply (1 / (1 + count _lastPositions));
if (_timestep != 0) then {
_aproximateVelocity = (_positionSum vectorDiff _lastPositionSum) vectorMultiply (1 / _timestep);
};
} else { } else {
_positionSum = _positionSum vectorMultiply (1 / count _lastPositions); _positionSum = _positionSum vectorMultiply (1 / count _lastPositions);
}; };
_seekerParams set [6, _positionSum];
_targetData set [0, (getPosASL _projectile) vectorFromTo _positionSum]; _targetData set [0, (getPosASL _projectile) vectorFromTo _positionSum];
_targetData set [3, _aproximateVelocity];
TRACE_3("laser target found",_foundTargetPos,_positionSum,count _lastPositions); TRACE_3("laser target found",_foundTargetPos,_positionSum,count _lastPositions);

View File

@ -37,10 +37,12 @@ Seeker Types:
Navigation Types: Navigation Types:
X GBU-12 - LOS Guidance X GBU-12 - LOS Guidance
X NLAW - LOS Guidance X NLAW - LOS Guidance
X Dragon - LOS Guidance
X Metis - LOS Guidance X Dragon - NA
X HOT - LOS Guidance
Vikhr - LOS Guidance Metis - Wire/Beam Guidance
HOT - Wire/Beam Guidance
Vikhr - Wire/Beam Guidance
X DAGR - APN X DAGR - APN
X AGM-65 - APN X AGM-65 - APN
@ -64,6 +66,7 @@ Navigation State Machine:
Navigation Types: Navigation Types:
X Augmented Pro-Nav X Augmented Pro-Nav
X Zero Effort Miss X Zero Effort Miss
Wire/Beam Guided
General To-Do: General To-Do:
Add more weapons Add more weapons