more SACLOS tweaks

This commit is contained in:
Brandon Danyluk 2022-01-01 21:28:54 -07:00
parent 9452de5f07
commit 20ad6283b7
9 changed files with 54 additions and 42 deletions

View File

@ -58,8 +58,8 @@ class CfgAmmo {
class ace_missileguidance {
enabled = 1;
pitchRate = 15; // Minium flap deflection for guidance
yawRate = 15; // Maximum flap deflection for guidance
pitchRate = 45; // Minium flap deflection for guidance
yawRate = 45; // Maximum flap deflection for guidance
canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode
@ -75,8 +75,10 @@ class CfgAmmo {
defaultNavigationType = "Line";
navigationTypes[] = { "Line" };
lineGainP = 15;
lineGainD = 15;
lineGainP = 35;
lineGainD = 30;
initialPitch = 2;
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
@ -85,7 +87,7 @@ class CfgAmmo {
seekerMinRange = 75;
seekerMaxRange = 4000; // Range from the missile which the seeker can visually search
correctionDistance = 15; // distance from center of crosshair where missile slows down
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

View File

@ -10,8 +10,9 @@ class CfgAmmo {
class ace_missileguidance {
enabled = 1;
pitchRate = 25; // Minium flap deflection for guidance
yawRate = 25; // Maximum flap deflection for guidance
pitchRate = 50; // Minium flap deflection for guidance
yawRate = 50; // Maximum flap deflection for guidance
initialPitch = 2;
canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode
@ -27,8 +28,8 @@ class CfgAmmo {
defaultNavigationType = "Line";
navigationTypes[] = { "Line" };
lineGainP = 10;
lineGainD = 10;
lineGainP = 30;
lineGainD = 30;
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
@ -37,7 +38,7 @@ class CfgAmmo {
seekerMinRange = 80;
seekerMaxRange = 2000; // Range from the missile which the seeker can visually search
correctionDistance = 15; // distance from center of crosshair where missile slows down
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

View File

@ -17,19 +17,26 @@
* Public: No
*/
params ["_seekerTargetPos", "_args", "_attackProfileStateParams"];
_args params ["_firedEH"];
_args params ["_firedEH", "", "", "", "", "_targetData"];
_firedEH params ["_shooter","","","","","","_projectile"];
_attackProfileStateParams params["_maxCorrectableDistance", "_wireCut", "_randomVector", "_crosshairOffset", "_seekerMaxRangeSqr", "_seekerMinRangeSqr", "_wireCutSource", "_distanceAheadOfMissile"];
_attackProfileStateParams params ["_maxCorrectableDistance", "_wireCut", "_lastInput", "_crosshairOffset", "_seekerMaxRangeSqr", "_seekerMinRangeSqr", "_wireCutSource", "_distanceAheadOfMissile"];
private _projectilePos = getPosASL _projectile;
private _shooterPos = getPosASL _shooter;
private _distanceToProjectile = _shooterPos vectorDistanceSqr _projectilePos;
if (_seekerTargetPos isEqualTo [0, 0, 0] || { _distanceToProjectile < _seekerMinRangeSqr }) exitWith {
// return position 50m infront of projectile and a bit up to get out of the way of the ground
_projectilePos vectorAdd (_projectile vectorModelToWorld [0, 50, 3])
if ((_distanceToProjectile > _seekerMaxRangeSqr) || { _wireCut }) exitWith {
// wire snap, random direction
if !(_wireCut) then {
_attackProfileStateParams set [1, true];
};
_lastInput
};
_seekerTargetPos vectorAdd _crosshairOffset
private _final = _seekerTargetPos vectorAdd _crosshairOffset;
_attackProfileStateParams set [2, _final];
_targetData set [0, _projectilePos vectorFromTo _final];
_final

View File

@ -17,9 +17,9 @@
* Public: No
*/
params ["_seekerTargetPos", "_args", "_attackProfileStateParams"];
_args params ["_firedEH"];
_args params ["_firedEH", "", "", "", "", "_targetData"];
_firedEH params ["_shooter","","","","","","_projectile"];
_attackProfileStateParams params["_maxCorrectableDistance", "_wireCut", "_randomVector", "_crosshairOffset", "_seekerMaxRangeSqr", "_seekerMinRangeSqr", "_wireCutSource", "_distanceAheadOfMissile"];
_attackProfileStateParams params ["_maxCorrectableDistance", "_wireCut", "_lastInput", "_crosshairOffset", "_seekerMaxRangeSqr", "_seekerMinRangeSqr", "_wireCutSource", "_distanceAheadOfMissile"];
private _projectilePos = getPosASL _projectile;
private _shooterPos = getPosASL _shooter;
@ -28,22 +28,17 @@ private _distanceToProjectile = _shooterPos vectorDistanceSqr _projectilePos;
if ((_distanceToProjectile > _seekerMaxRangeSqr) || { _wireCut }) exitWith {
// wire snap, random direction
if (_randomVector isEqualTo [0, 0, 0]) then {
_randomVector = RANDOM_VECTOR_3D vectorMultiply 300;
if !(_wireCut) then {
_attackProfileStateParams set [1, true];
_attackProfileStateParams set [2, _randomVector];
playSound3D ["a3\sounds_f\air\sfx\SL_rope_break.wss", objNull, false, AGLtoASL (_shooter modelToWorld _wireCutSource), 5, 1, 150];
};
private _randomDir = _projectilePos vectorAdd _randomVector;
_targetData set [0, _projectilePos vectorFromTo _randomDir];
_targetData set [2, _randomDir distance _projectilePos];
_randomDir
_lastInput
};
if (_seekerTargetPos isEqualTo [0, 0, 0] || { _distanceToProjectile < _seekerMinRangeSqr }) exitWith {
_projectilePos vectorAdd (_projectile vectorModelToWorld [0, 5, 5])
};
private _final = _seekerTargetPos vectorAdd _crosshairOffset;
_attackProfileStateParams set [2, _final];
_seekerTargetPos vectorAdd _crosshairOffset
_targetData set [0, _projectilePos vectorFromTo _final];
_final

View File

@ -200,7 +200,7 @@ if ((_pitchRate != 0 || {_yawRate != 0})) then {
_projectile setVectorDirAndUp [_dir, _up];
//[_projectile, _pitch, _yaw, 0] call FUNC(changeMissileDirection);
_guidanceParameters set [0, _yaw];
_guidanceParameters set [2, _pitch];

View File

@ -22,6 +22,9 @@ _flightParams params ["_pitchRate", "_yawRate"];
_navigationParams params ["_proportionalGain", "", "_derivativeGain", "_lastErrorX", "_lastErrorY", "_correctionDistance"];
private _targetDistance = _projectile vectorWorldToModelVisual (_targetDir vectorMultiply _distance);
_proportionalGain = 30;
_derivativeGain = 30;
_correctionDistance = 3;
private _errorX = _targetDistance#0 / _correctionDistance;
private _errorY = _targetDistance#2 / _correctionDistance;
@ -43,9 +46,9 @@ private _accelerationX = _pX + _dX;
private _accelerationY = _pY + _dY;
private _commandedAcceleration = [
_accelerationX * _yawRate,
_accelerationX,
0,
_accelerationY * _pitchRate
_accelerationY
];
_navigationParams set [3, _errorX];

View File

@ -140,8 +140,12 @@ if (_states isNotEqualTo []) then {
} forEach _states;
};
private _initialRoll = getNumber (_config >> "initialRoll");
private _initialYaw = getNumber (_config >> "initialYaw");
private _initialPitch = getNumber (_config >> "initialPitch");
private _yawRollPitch = (vectorDir _projectile) call CBA_fnc_vect2Polar;
private _pitchYaw = (vectorDir _projectile) call CBA_fnc_vect2Polar;
TRACE_5("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile,_navigationType);
private _args = [_this,
[ _shooter,
@ -165,7 +169,7 @@ private _args = [_this,
getNumber ( _config >> "seekerMaxRange" ),
getNumber ( _config >> "seekerMinRange" )
],
[ diag_tickTime, [], [], _lastKnownPosState, _navigationParameters, [_pitchYaw select 1, 0, _pitchYaw select 2]],
[ diag_tickTime, [], [], _lastKnownPosState, _navigationParameters, [_initialYaw + (_yawRollPitch select 1), _initialRoll, _initialPitch + (_yawRollPitch select 2)]],
[
// target data from missile. Must be filled by seeker for navigation to work
[0, 0, 0], // direction to target

View File

@ -22,7 +22,7 @@ _seekerParams params ["_seekerAngle"];
_stateParams params ["", "_seekerStateParams"];
_seekerStateParams params ["_memoryPointGunnerOptics", "_animationSourceBody", "_animationSourceGun", "_usePilotCamera"];
private _shooterPos = AGLToASL (_shooter modelToWorld(_shooter selectionPosition _memoryPointGunnerOptics));
private _shooterPos = AGLToASL (_shooter modelToWorldVisual (_shooter selectionPosition _memoryPointGunnerOptics));
private _projPos = getPosASL _projectile;
private _lookDirection = if !(_shooter isKindOf "CAManBase" || {_shooter isKindOf "StaticWeapon"}) then {
@ -60,7 +60,7 @@ if ((_testDotProduct < (cos _seekerAngle)) || {_testIntersections isNotEqualTo [
private _returnPos = _shooterPos vectorAdd (_lookDirection vectorMultiply _distanceToProj);
_targetData set [0, _lookDirection];
_targetData set [0, _projPos vectorFromTo _returnPos];
_targetData set [2, _returnPos vectorDistance getPosASLVisual _projectile];
_returnPos

View File

@ -12,8 +12,8 @@ class CfgAmmo {
enabled = 1;
showTrail = 1;
pitchRate = 10; // Minium flap deflection for guidance
yawRate = 10; // Maximum flap deflection for guidance
pitchRate = 60; // Minium flap deflection for guidance
yawRate = 60; // Maximum flap deflection for guidance
canVanillaLock = 1; // Can this default vanilla lock? Only applicable to non-cadet mode
@ -27,9 +27,9 @@ class CfgAmmo {
defaultNavigationType = "Line";
navigationTypes[] = { "Line" };
lineGainP = 25;
lineGainD = 20;
correctionDistance = 2;
lineGainP = 40;
lineGainD = 30;
correctionDistance = 5;
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