mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
improve lin navigation
This commit is contained in:
parent
34c7b57532
commit
d8ebc35359
@ -18,8 +18,10 @@
|
||||
*/
|
||||
|
||||
params ["_seekerTargetPos", "_args"];
|
||||
_args params ["_firedEH"];
|
||||
_args params ["_firedEH", "_launchParams"];
|
||||
_firedEH params ["_shooter","","","","","","_projectile"];
|
||||
_launchParams params ["","_targetLaunchParams"];
|
||||
_targetLaunchParams params ["", "", "_launchPos"];
|
||||
|
||||
if (_seekerTargetPos isEqualTo [0,0,0]) exitWith {_seekerTargetPos};
|
||||
|
||||
@ -30,27 +32,29 @@ private _distanceToTarget = _projectilePos vectorDistance _seekerTargetPos;
|
||||
private _distanceToShooter = _projectilePos vectorDistance _shooterPos;
|
||||
private _distanceShooterToTarget = _shooterPos vectorDistance _seekerTargetPos;
|
||||
|
||||
private _ttgo = _distanceToTarget / (vectorMagnitude velocity _projectile);
|
||||
|
||||
TRACE_2("", _distanceToTarget, _distanceToShooter);
|
||||
|
||||
// Add height depending on distance for compensate
|
||||
private _addHeight = [0,0,0];
|
||||
|
||||
// Always climb an arc on initial launch if we are close to the round
|
||||
if ((((ASLtoAGL _projectilePos) select 2) < 5) && {_distanceToShooter < 15}) then {
|
||||
_addHeight = _addHeight vectorAdd [0,0,_distanceToTarget];
|
||||
TRACE_1("climb - near shooter",_addHeight);
|
||||
} else {
|
||||
// If we are below the target, increase the climbing arc
|
||||
if (((_projectilePos select 2) < (_seekerTargetPos select 2)) && {_distanceToTarget > 100}) then {
|
||||
_addHeight = _addHeight vectorAdd [0,0, ((_seekerTargetPos select 2) - (_projectilePos select 2))];
|
||||
TRACE_1("climb - below target and far",_addHeight);
|
||||
};
|
||||
};
|
||||
private _2dDistance = (800 + (_projectilePos distance2D _launchPos)) / (_projectilePos distance2D _seekerTargetPos);
|
||||
|
||||
// Projectile above target
|
||||
if ((_projectilePos select 2) > (_seekerTargetPos select 2)) then {
|
||||
TRACE_1("above - far",_addHeight);
|
||||
_addHeight = _addHeight vectorAdd [0,0, _distanceToTarget / 50];
|
||||
if (_2dDistance <= 1) then {
|
||||
_addHeight = [0, 0, (_projectilePos#2) + 8];
|
||||
} else {
|
||||
// Always climb an arc on initial launch if we are close to the round
|
||||
if ((((ASLtoAGL _projectilePos) select 2) < 5) && {_distanceToShooter < 15}) then {
|
||||
_addHeight = _addHeight vectorAdd [0,0,_distanceToTarget];
|
||||
TRACE_1("climb - near shooter",_addHeight);
|
||||
} else {
|
||||
// If we are below the target, increase the climbing arc
|
||||
if (((_projectilePos select 2) < (_seekerTargetPos select 2)) && {_distanceToTarget > 100}) then {
|
||||
_addHeight = _addHeight vectorAdd [0,0, ((_seekerTargetPos select 2) - (_projectilePos select 2))];
|
||||
TRACE_1("climb - below target and far",_addHeight);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
private _returnTargetPos = _seekerTargetPos vectorAdd _addHeight;
|
||||
|
Loading…
Reference in New Issue
Block a user