mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Laser seeker range improvements (#5365)
* Workaround for laser max range. Made laser hud seeker use ammo values. * Nested ifs for optimization of check
This commit is contained in:
parent
03b51a6c50
commit
a0b5f9f2d5
@ -91,9 +91,12 @@ GVAR(pfID) = [{
|
||||
private _ctrlIcon = (uiNamespace getVariable [QGVAR(display), displayNull]) displayCtrl IDC_LASERICON;
|
||||
|
||||
// Do Laser Scan:
|
||||
private _ammo = getText (configFile >> "CfgMagazines" >> _vehicle currentMagazineTurret _turretPath >> "ammo");
|
||||
private _laserSource = AGLtoASL (_vehicle modelToWorld (_vehicle selectionPosition _seekerSource));
|
||||
private _laserCode = _vehicle getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE];
|
||||
private _laserResult = [_laserSource, vectorDir _vehicle, 70, 5000, [ACE_DEFAULT_LASER_WAVELENGTH,ACE_DEFAULT_LASER_WAVELENGTH], _laserCode, _vehicle] call EFUNC(laser,seekerFindLaserSpot);
|
||||
private _seekerAngle = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ace_missileguidance" >> "seekerAngle");
|
||||
private _seekerMaxRange = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ace_missileguidance" >> "seekerMaxRange");
|
||||
private _laserResult = [_laserSource, vectorDir _vehicle, _seekerAngle, _seekerMaxRange, [ACE_DEFAULT_LASER_WAVELENGTH,ACE_DEFAULT_LASER_WAVELENGTH], _laserCode, _vehicle] call EFUNC(laser,seekerFindLaserSpot);
|
||||
private _foundTargetPos = _laserResult select 0;
|
||||
private _haveLock = !isNil "_foundTargetPos";
|
||||
|
||||
|
@ -25,15 +25,15 @@
|
||||
|
||||
BEGIN_COUNTER(seekerFindLaserSpot);
|
||||
|
||||
params ["_posASL", "_dir", "_seekerFov", "_seekerMaxDistnace", "_seekerWavelengths", "_seekerCode", ["_ignoreObj1", objNull]];
|
||||
params ["_posASL", "_dir", "_seekerFov", "_seekerMaxDistance", "_seekerWavelengths", "_seekerCode", ["_ignoreObj1", objNull]];
|
||||
|
||||
_dir = vectorNormalized _dir;
|
||||
_seekerWavelengths params ["_seekerWavelengthMin", "_seekerWavelengthMax"];
|
||||
|
||||
private _seekerCos = cos _seekerFov;
|
||||
private _seekerMaxDistSq = _seekerMaxDistnace ^ 2;
|
||||
private _seekerMaxDistSq = _seekerMaxDistance ^ 2;
|
||||
|
||||
TRACE_6("",_posASL,_dir,_seekerFov,_seekerMaxDistnace,_seekerWavelengths,_seekerCode);
|
||||
TRACE_6("",_posASL,_dir,_seekerFov,_seekerMaxDistance,_seekerWavelengths,_seekerCode);
|
||||
|
||||
private _spots = [];
|
||||
private _finalPos = nil;
|
||||
|
@ -28,6 +28,13 @@ private _resultPos = nil;
|
||||
|
||||
private _farPoint = _posASL vectorAdd (_dir vectorMultiply 10000);
|
||||
private _intersects = lineIntersectsSurfaces [_posASL, _farPoint, _ignoreVehicle1, _ignoreVehicle2];
|
||||
// workaround for lineIntersectsSurfaces using a hardcoded max distance of 5000m. New max distance 15000m
|
||||
if (_intersects isEqualTo []) then {
|
||||
_intersects = lineIntersectsSurfaces [_posASL vectorAdd (_dir vectorMultiply 5000), _farPoint vectorAdd (_dir vectorMultiply 5000), _ignoreVehicle1, _ignoreVehicle2];
|
||||
if (_intersects isEqualTo []) then {
|
||||
_intersects = lineIntersectsSurfaces [_posASL vectorAdd (_dir vectorMultiply 10000), _farPoint vectorAdd (_dir vectorMultiply 10000), _ignoreVehicle1, _ignoreVehicle2];
|
||||
};
|
||||
};
|
||||
|
||||
if (!(_intersects isEqualTo [])) then {
|
||||
(_intersects select 0) params ["_intersectPosASL", "", "_intersectObject"];
|
||||
|
Loading…
Reference in New Issue
Block a user