diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index 83ed4848bf..cdd6546e68 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -31,7 +31,7 @@ if (!alive _projectile || isNull _projectile || isNull _shooter) exitWith { END_COUNTER(guidancePFH); }; -_flightParams params ["_pitchRate", "_yawRate"]; +_flightParams params ["_pitchRate", "_yawRate", "_isBangBangGuidance"]; // Run seeker function: private _seekerTargetPos = [[0,0,0], _args, _seekerStateParams, _lastKnownPosState] call FUNC(doSeekerSearch); @@ -64,6 +64,14 @@ if ((_pitchRate != 0 || {_yawRate != 0}) && {_profileAdjustedTargetPos isNotEqua private _clampedPitch = (_pitchChange min _pitchRate) max -_pitchRate; private _clampedYaw = (_yawChange min _yawRate) max -_yawRate; + // controls are either on or off, no proportional + if (_isBangBangGuidance) then { + private _pitchSign = _clampedPitch / abs _clampedPitch; + private _yawSign = _clampedYaw / abs _clampedYaw; + _clampedPitch = _pitchSign * _pitchRate; + _clampedYaw = _yawSign * _clampedYaw; + }; + TRACE_9("pitch/yaw/roll",_pitch,_yaw,_roll,_yawChange,_pitchChange,_pitchRate,_yawRate,_clampedPitch,_clampedYaw); _pitch = _pitch + _clampedPitch * TIMESTEP_FACTOR; diff --git a/addons/missileguidance/functions/fnc_onFired.sqf b/addons/missileguidance/functions/fnc_onFired.sqf index d324c573a9..81ef1ed1a3 100644 --- a/addons/missileguidance/functions/fnc_onFired.sqf +++ b/addons/missileguidance/functions/fnc_onFired.sqf @@ -111,9 +111,11 @@ private _navigationParameters = [ // default config values to make sure there is backwards compat private _pitchRate = 30; private _yawRate = 30; +private _bangBang = false; if (isNumber (_config >> "pitchRate")) then { _pitchRate = getNumber ( _config >> "pitchRate" ); _yawRate = getNumber ( _config >> "yawRate" ); + _bangBang = 1 == getNumber (_config >> "bangBangGuidance"); }; TRACE_5("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile,_navigationType); @@ -128,7 +130,8 @@ private _args = [_this, ], [ _pitchRate, - _yawRate + _yawRate, + _bangBang ], [ getNumber ( _config >> "seekerAngle" ),