From 7bb7b6fb78b2be805249408d78fcee92d71b0294 Mon Sep 17 00:00:00 2001 From: Brandon Danyluk Date: Sat, 1 Jan 2022 18:20:59 -0700 Subject: [PATCH] enhance target designation --- .../spike/functions/fnc_getTargetPosition.sqf | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/addons/spike/functions/fnc_getTargetPosition.sqf b/addons/spike/functions/fnc_getTargetPosition.sqf index 2836d5b862..c07c28c7f0 100644 --- a/addons/spike/functions/fnc_getTargetPosition.sqf +++ b/addons/spike/functions/fnc_getTargetPosition.sqf @@ -18,15 +18,34 @@ */ #define CHECK_DISTANCE 10 #define SEEKER_BIAS 50 +#define SEEKER_GRID_RADIUS 2 +#define MAX_RANGE 5000 params ["_origin", "_direction", "_designateInput", "_seekerTargetPos", "_seeker", ["_ignoreObject", objNull]]; scopeName "main"; private _nearObjects = []; private _desiredObject = objNull; -private _intersections = lineIntersectsSurfaces [_origin, _origin vectorAdd (_direction vectorMultiply 5000), _ignoreObject, objNull, true, 1, "FIRE", "VIEW", true]; +private _intersections = []; +if (_designateInput == 1) then { + for "_xOffset" from -SEEKER_GRID_RADIUS to SEEKER_GRID_RADIUS do { + for "_yOffset" from -SEEKER_GRID_RADIUS to SEEKER_GRID_RADIUS do { + private _testPosASL = AGLtoASL (positionCameraToWorld [_xOffset, _yOffset, MAX_RANGE]); + private _intersectionsToCursorTarget = lineIntersectsSurfaces [_origin, _testPosASL, _ignoreObject, objNull, true, 1, "FIRE", "VIEW", true]; + #ifdef DEBUG_MODE_FULL + drawIcon3D ["\A3\ui_f\data\map\markers\military\dot_CA.paa", [0,1,0,1], ASLtoAGL _testPosASL, 0.25, 0.25, 0, "", 0.5, 0.025, "TahomaB"]; + #endif + if (_intersectionsToCursorTarget isNotEqualTo []) then { + _intersections append _intersectionsToCursorTarget; + }; + }; + }; +} else { + _intersections = lineIntersectsSurfaces [_origin, _origin vectorAdd (_direction vectorMultiply MAX_RANGE), _ignoreObject, objNull, true, 1, "FIRE", "VIEW", true] +}; + if (_intersections isNotEqualTo []) then { - (_intersections#0) params ["_intersectPos", "", "_object"]; + (_intersections select 0) params ["_intersectPos", "", "_object"]; if (_designateInput == 1) then { _seekerTargetPos = _intersectPos;