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"
|
2016-09-04 14:44:22 +00:00
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2015-04-12 19:16:26 +00:00
|
|
|
true
|