ACE3/addons/missileguidance/functions/fnc_checkSeekerAngle.sqf

31 lines
776 B
Plaintext
Raw Normal View History

2016-05-30 16:37:03 +00:00
/*
* Author: jaynus
* Returns whether the target position is within the maximum angle FOV of the provided seeker
* objects current direction.
*
2016-06-18 09:50:41 +00:00
* Arguments:
2016-05-30 16:37:03 +00:00
* 0: Seeker [Object]
* 1: Target [Position]
* 2: Max Angle [Degrees]
*
2016-06-18 09:50:41 +00:00
* Return Value:
2016-05-30 16:37:03 +00:00
* Boolean
*/
#include "script_component.hpp"
private ["_seeker", "_targetPos", "_seekerMaxAngle", "_sensorPos", "_testPointVector", "_testDotProduct"];
2016-05-30 16:37:03 +00:00
_seeker = _this select 0;
_targetPos = _this select 1;
_seekerMaxAngle = _this select 2;
_sensorPos = getPosASL _seeker;
_testPointVector = vectorNormalized (_targetPos vectorDiff _sensorPos);
_testDotProduct = (vectorNormalized (velocity _seeker)) vectorDotProduct _testPointVector;
if(_testDotProduct < (cos _seekerMaxAngle)) exitWith {
false
};
true