2015-04-12 19:16:26 +00:00
|
|
|
/*
|
|
|
|
* Author: jaynus
|
|
|
|
* Returns whether the target position is within the maximum angle FOV of the provided seeker
|
|
|
|
* objects current direction.
|
|
|
|
*
|
|
|
|
* Argument:
|
|
|
|
* 0: Seeker [Object]
|
|
|
|
* 1: Target [Position]
|
|
|
|
* 2: Max Angle [Degrees]
|
|
|
|
*
|
|
|
|
* Return value:
|
|
|
|
* Boolean
|
|
|
|
*/
|
2015-04-13 02:49:14 +00:00
|
|
|
|
2015-04-12 19:16:26 +00:00
|
|
|
#include "script_component.hpp"
|
2015-04-13 02:49:14 +00:00
|
|
|
private["_seeker", "_targetPos", "_seekerMaxAngle", "_sensorPos", "_testPointVector", "_testDotProduct"];
|
2015-04-12 19:16:26 +00:00
|
|
|
|
|
|
|
_seeker = _this select 0;
|
|
|
|
_targetPos = _this select 1;
|
|
|
|
_seekerMaxAngle = _this select 2;
|
|
|
|
|
|
|
|
_sensorPos = getPosASL _seeker;
|
|
|
|
|
2015-04-13 02:49:14 +00:00
|
|
|
_testPointVector = vectorNormalized (_targetPos vectorDiff _sensorPos);
|
|
|
|
_testDotProduct = (vectorNormalized (velocity _seeker)) vectorDotProduct _testPointVector;
|
2015-04-12 19:16:26 +00:00
|
|
|
|
2015-04-13 04:47:27 +00:00
|
|
|
if(_testDotProduct < (cos _seekerMaxAngle)) exitWith {
|
2015-04-12 19:16:26 +00:00
|
|
|
false
|
|
|
|
};
|
|
|
|
|
|
|
|
true
|