mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
tweak navigation to allow for <200m shots
This commit is contained in:
parent
becc9d24ff
commit
fd5b8a27f1
@ -16,43 +16,36 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#define CHECK_DISTANCE 25
|
||||
params ["_origin", "_direction", "_designateInput", "_seekerTargetPos", ["_ignoreObject", objNull]];
|
||||
#define CHECK_DISTANCE 10
|
||||
#define SEEKER_BIAS 50
|
||||
params ["_origin", "_direction", "_designateInput", "_seekerTargetPos", "_seeker", ["_ignoreObject", objNull]];
|
||||
|
||||
scopeName "main";
|
||||
private _nearObjects = [];
|
||||
|
||||
if (cursorObject isKindOf "AllVehicles") then {
|
||||
private _intersectionsToCursorTarget = lineIntersectsSurfaces [_origin, aimPos cursorObject, _ignoreObject, cursorObject, true, 1];
|
||||
if (_intersectionsToCursorTarget isEqualTo []) then {
|
||||
_nearObjects pushBack cursorObject;
|
||||
};
|
||||
};
|
||||
|
||||
private _desiredObject = objNull;
|
||||
private _intersections = lineIntersectsSurfaces [_origin, _origin vectorAdd (_direction vectorMultiply 5000), _ignoreObject, objNull, true, 1, "FIRE", "VIEW", true];
|
||||
if (_intersections isNotEqualTo []) then {
|
||||
(_intersections#0) params ["_intersectPos", "", "_object"];
|
||||
|
||||
drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,1], ASLtoAGL _intersectPos, 0.75, 0.75, 0, "", 1, 0.025, "TahomaB"];
|
||||
|
||||
if (_designateInput == 1) then {
|
||||
_seekerTargetPos = _intersectPos;
|
||||
};
|
||||
|
||||
_nearObjects = (ASLtoAGL _seekerTargetPos) nearObjects ["AllVehicles", 5];
|
||||
_nearObjects = (ASLtoAGL _seekerTargetPos) nearObjects ["AllVehicles", CHECK_DISTANCE];
|
||||
|
||||
if (_designateInput == 1 && { !isNull _object }) then {
|
||||
if (_designateInput == 1 && { !isNull _object } && { _object isKindOf "Building" }) then {
|
||||
_nearObjects pushBack _object;
|
||||
if (isNull _desiredObject) then {
|
||||
_desiredObject = _object;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (_nearObjects isNotEqualTo []) then {
|
||||
// I want to prefer the designated position on the object moreso than the bounds of the object
|
||||
private _averagePosition = _seekerTargetPos vectorMultiply 15;
|
||||
private _averagePositionCounter = 15;
|
||||
|
||||
private _highestMagnitude = 0;
|
||||
private _closestDistance = 1e10;
|
||||
private _averagePosition = _seekerTargetPos vectorMultiply SEEKER_BIAS;
|
||||
private _averagePositionCounter = SEEKER_BIAS;
|
||||
|
||||
private _bestScore = 0;
|
||||
private _bestObject = objNull;
|
||||
@ -61,12 +54,13 @@ if (_nearObjects isNotEqualTo []) then {
|
||||
private _tiMagnitude = (vectorMagnitude getVehicleTIPars _x) / 1.74; // 1.74 = sqrt(3) = max magnitude of [1, 1, 1]
|
||||
private _distance = (getPosASLVisual _x) vectorDistanceSqr _seekerTargetPos;
|
||||
|
||||
if (_distance <= CHECK_DISTANCE * CHECK_DISTANCE) then {
|
||||
private _score = 8 * _tiMagnitude + (_distance / (CHECK_DISTANCE * CHECK_DISTANCE));
|
||||
if (_score > _bestScore) then {
|
||||
_bestScore = _score;
|
||||
_bestObject = _x;
|
||||
};
|
||||
private _score = 4 * _tiMagnitude + (_distance / (CHECK_DISTANCE * CHECK_DISTANCE));
|
||||
if (_desiredObject isEqualTo _x) then {
|
||||
_score = _score * 2;
|
||||
};
|
||||
if (_score > _bestScore) then {
|
||||
_bestScore = _score;
|
||||
_bestObject = _x;
|
||||
};
|
||||
} forEach _nearObjects;
|
||||
|
||||
|
@ -55,7 +55,7 @@ if (cameraView isEqualTo "GUNNER") then {
|
||||
if (_currentAmmo != 0 && { _designating == 1 || _targetPosition isNotEqualTo [0, 0, 0] }) then {
|
||||
private _viewASL = AGLtoASL positionCameraToWorld [0,0,0];
|
||||
private _viewDir = _viewASL vectorFromTo (AGLtoASL positionCameraToWorld [0,0,1]);
|
||||
_targetPosition = [_viewASL, _viewDir, _designating, _targetPosition, _currentShooter] call FUNC(getTargetPosition);
|
||||
_targetPosition = [_viewASL, _viewDir, _designating, _targetPosition, _currentShooter, _currentShooter] call FUNC(getTargetPosition);
|
||||
GVAR(arguments) set [1, _targetPosition];
|
||||
};
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#define ARM_TIME 0.5
|
||||
params ["_args", "_timestep", "", "_profileAdjustedTargetPos", "", "_navigationParams"];
|
||||
_args params ["_firedEH", "_launchParams", "_flightParams", "_seekerParams", "_stateParams", "_targetData", "_navigationStateData"];
|
||||
_firedEH params ["_shooter","","","","_ammo","","_projectile"];
|
||||
@ -95,8 +96,15 @@ switch (_stage) do {
|
||||
default {};
|
||||
};
|
||||
|
||||
(_directionToTarget call CBA_fnc_vect2polar) params ["", "", "_elevationToTarget"];
|
||||
if (_stage >= STAGE_LAUNCH && { _profileAdjustedTargetPos isNotEqualTo [0, 0, 0] } && { -_elevationToTarget >= 30 }) then {
|
||||
private _distance = _launchPos vectorDistance _profileAdjustedTargetPos;
|
||||
|
||||
private _los = _projectilePos vectorFromTo _profileAdjustedTargetPos;
|
||||
// subtract 500 so we dont get a perfect top-attack angle
|
||||
private _ttgo = ((_projectilePos distance2D _profileAdjustedTargetPos) - 500) / (vectorMagnitude velocity _projectile);
|
||||
private _angleToTarget = acos ((vectorDir _projectile) vectorCos _los);
|
||||
private _atMinRotationAngle = _angleToTarget >= (_pitchRate * _ttgo);
|
||||
|
||||
if (_met >= ARM_TIME && { _stage >= STAGE_LAUNCH } && { _profileAdjustedTargetPos isNotEqualTo [0, 0, 0] } && { _atMinRotationAngle }) then {
|
||||
_navigationParams set [0, STAGE_TERMINAL];
|
||||
};
|
||||
|
||||
|
@ -17,7 +17,8 @@
|
||||
*/
|
||||
|
||||
params ["", "_args", "_seekerStateParams", "", "_timestep"];
|
||||
_args params ["_firedEH", "", "", "", "", "_targetData"];
|
||||
_args params ["_firedEH", "", "", "_seekerParams", "", "_targetData"];
|
||||
_seekerParams params ["_seekerAngle", "", "_seekerMaxRange", "_seekerMinRange"];
|
||||
_firedEH params ["","","","","","","_projectile"];
|
||||
|
||||
(GVAR(projectileHashMap) get hashValue _projectile) params ["_cameraNamespace", "_preTarget"];
|
||||
@ -36,7 +37,7 @@ if (_seekerTargetPos isEqualTo [0, 0, 0]) then {
|
||||
};
|
||||
|
||||
if ((_seekerTargetPos isNotEqualTo [0, 0, 0]) || { (_designateInput == 1) }) then {
|
||||
_seekerTargetPos = [_cameraPos, vectorNormalized _logicPos, _designateInput, _seekerTargetPos] call FUNC(getTargetPosition);
|
||||
_seekerTargetPos = [_cameraPos, vectorNormalized _logicPos, _designateInput, _seekerTargetPos, _projectile] call FUNC(getTargetPosition);
|
||||
};
|
||||
|
||||
_cameraNamespace setVariable [QGVAR(seekerTargetPos), _seekerTargetPos];
|
||||
|
Loading…
Reference in New Issue
Block a user