Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MissileGuidance - Active Radar Homing: Use AGL for nearestObjects check #8045

Merged
merged 2 commits into from
Dec 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions addons/missileguidance/functions/fnc_seekerType_ARH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if (_isActive || { CBA_missionTime >= _timeWhenActive }) then {
_seekerStateParams set [6, true];
TRACE_1("Missile Pitbull",_seekerStateParams);
};

// Internal radar homing
// For performance reasons only poll for target every so often instead of each frame
if ((_lastTargetPollTime + ACTIVE_RADAR_POLL_FREQUENCY) - CBA_missionTime < 0) then {
Expand Down Expand Up @@ -59,7 +60,7 @@ if (_isActive || { CBA_missionTime >= _timeWhenActive }) then {
_seekerBaseRadiusAdjusted = _seekerBaseRadiusAtGround;
};
// Look in front of seeker for any targets
private _nearestObjects = nearestObjects [_searchPos, ["Air", "LandVehicle", "Ship"], _seekerBaseRadiusAdjusted, false];
private _nearestObjects = nearestObjects [ASLtoAGL _searchPos, ["Air", "LandVehicle", "Ship"], _seekerBaseRadiusAdjusted, false];

_nearestObjects = _nearestObjects apply {
// I check both Line of Sight versions to make sure that a single bush doesnt make the target lock dissapear but at the same time ensure that this can see through smoke. Should work 80% of the time
Expand All @@ -70,7 +71,6 @@ if (_isActive || { CBA_missionTime >= _timeWhenActive }) then {
};
};
_nearestObjects = _nearestObjects select { !isNull _x };

// Select closest object to the expected position to be the current radar target
if ((count _nearestObjects) <= 0) exitWith {
_projectile setMissileTarget objNull;
Expand All @@ -83,6 +83,7 @@ if (_isActive || { CBA_missionTime >= _timeWhenActive }) then {
_target = _x;
};
} forEach _nearestObjects;

_expectedTargetPos = _searchPos;
};

Expand Down