2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-05-30 16:37:03 +00:00
|
|
|
/*
|
|
|
|
* Author: jaynus
|
2016-10-12 22:35:24 +00:00
|
|
|
* Returns whether the target position is within the maximum angle FOV of the provided seeker
|
2016-05-30 16:37:03 +00:00
|
|
|
* objects current direction.
|
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Arguments:
|
2016-10-12 22:35:24 +00:00
|
|
|
* 0: Seeker <OBJECT>
|
|
|
|
* 1: Target PosASL <ARRAY>
|
|
|
|
* 2: Max Angle (degrees) <NUMBER>
|
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Return Value:
|
2016-10-12 22:35:24 +00:00
|
|
|
* Can See <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [player, cursorTarget, 45] call ace_missileguidance_fnc_checkSeekerAngle;
|
|
|
|
*
|
|
|
|
* Public: No
|
2016-05-30 16:37:03 +00:00
|
|
|
*/
|
|
|
|
|
2016-10-12 22:35:24 +00:00
|
|
|
params ["_seeker", "_targetPos", "_seekerMaxAngle"];
|
|
|
|
|
|
|
|
private _sensorPos = getPosASL _seeker;
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-10-12 22:35:24 +00:00
|
|
|
private _testPointVector = vectorNormalized (_targetPos vectorDiff _sensorPos);
|
|
|
|
private _testDotProduct = (vectorNormalized (velocity _seeker)) vectorDotProduct _testPointVector;
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-10-12 22:35:24 +00:00
|
|
|
TRACE_2("fov",acos _testDotProduct,_seekerMaxAngle);
|
2016-05-30 16:37:03 +00:00
|
|
|
|
2016-10-12 22:35:24 +00:00
|
|
|
if (_testDotProduct < (cos _seekerMaxAngle)) exitWith {
|
|
|
|
false
|
2016-05-30 16:37:03 +00:00
|
|
|
};
|
|
|
|
|
2016-10-12 22:35:24 +00:00
|
|
|
true
|