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

missleGuidance - Fix seeker los check #3986

Merged
merged 1 commit into from
Jun 25, 2016
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
11 changes: 6 additions & 5 deletions addons/missileguidance/functions/fnc_seekerType_Optic.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ _angleOkay = [_projectile, _foundTargetPos, _angleFov] call FUNC(checkSeekerAngl

_losOkay = false;
if(_angleOkay) then {
_losOkay = [_projectile, _target] call FUNC(checkSeekerLos); //Note: Func does not exist? probably FUNC(checkLos)??
_losOkay = [_projectile, _target] call FUNC(checkLos);
};
TRACE_2("", _angleOkay, _losOkay);

Expand All @@ -36,16 +36,17 @@ if(!_angleOkay || !_losOkay) then {
_foundTargetPos = _sensorPos vectorAdd ((velocity _projectile) vectorMultiply 5);
} else {
TRACE_2("", _target, _foundTargetPos);
private["_projectileSpeed", "_distanceToTarget", "_eta", "_adjustVelocity"];
private["_projectileSpeed", "_distanceToTarget", "_eta", "_adjustDistance"];
// @TODO: Configurable lead for seekers
_projectileSpeed = (vectorMagnitude velocity _projectile);
_distanceToTarget = (getPosASL _projectile) vectorDistance _foundTargetPos;

_eta = _distanceToTarget / _projectileSpeed;

_adjustVelocity = (velocity _target) vectorMultiply _eta;
_foundTargetPos = _foundTargetPos vectorAdd _adjustVelocity;
_adjustDistance = (velocity _target) vectorMultiply _eta;
TRACE_3("leading target",_distanceToTarget,_eta,_adjustDistance);
_foundTargetPos = _foundTargetPos vectorAdd _adjustDistance;
};


TRACE_2("return",_foundTargetPos,(aimPos _target) distance _foundTargetPos);
_foundTargetPos;