mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Seeker integration.
This commit is contained in:
parent
5251de8447
commit
2e83e56a73
@ -4,6 +4,7 @@ PREP(rotateVectLineGetMap);
|
|||||||
PREP(rotateVectLine);
|
PREP(rotateVectLine);
|
||||||
|
|
||||||
PREP(checkSeekerAngle);
|
PREP(checkSeekerAngle);
|
||||||
|
PREP(checkLos);
|
||||||
|
|
||||||
PREP(fired);
|
PREP(fired);
|
||||||
|
|
||||||
|
29
addons/missileguidance/functions/fnc_checkLos.sqf
Normal file
29
addons/missileguidance/functions/fnc_checkLos.sqf
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Author: jaynus
|
||||||
|
* Returns whether the seeker object can see the target position with lineIntersect
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* 0: Seeker [Object]
|
||||||
|
* 1: Target [Object]
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* Boolean
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
private["_seeker", "_seekerPos", "_target", "_targetPos", "_return", "_vectorTo", "_searchPos"];
|
||||||
|
_seeker = _this select 0;
|
||||||
|
_target = _this select 1;
|
||||||
|
|
||||||
|
_targetPos = getPosASL _target;
|
||||||
|
_seekerPos = getPosASL _seeker;
|
||||||
|
_return = true;
|
||||||
|
|
||||||
|
if(!(terrainIntersectASL [ _seekerPos, _targetPos])) then {
|
||||||
|
if(lineIntersects [_seekerPos, _targetPos, _seeker, _target]) then {
|
||||||
|
_return = false;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
_return = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
_return;
|
@ -19,14 +19,31 @@ if(!isNil "_target") then {
|
|||||||
_foundTargetPos = getPosASL _target;
|
_foundTargetPos = getPosASL _target;
|
||||||
};
|
};
|
||||||
|
|
||||||
TRACE_2("", _target, _foundTargetPos);
|
/* @TODO: This is seeker LOS and angle checks for LOAL only; LOBL does not need visual
|
||||||
|
_angleFov = _seekerParams select 0;
|
||||||
|
_angleOkay = [_projectile, _foundTargetPos, _angleFov] call FUNC(checkSeekerAngle);
|
||||||
|
|
||||||
_projectileSpeed = (vectorMagnitude velocity _projectile);
|
_losOkay = false;
|
||||||
_distanceToTarget = (getPosASL _projectile) vectorDistance _foundTargetPos;
|
if(_angleOkay) then {
|
||||||
|
_losOkay = [_projectile, _target] call FUNC(checkSeekerLos);
|
||||||
|
};
|
||||||
|
TRACE_2("", _angleOkay, _losOkay);
|
||||||
|
|
||||||
_eta = _distanceToTarget / _projectileSpeed;
|
// If we got here, it was an invalid target, just return a spot 5m in front of the missile
|
||||||
|
if(!_angleOkay || !_losOkay) then {
|
||||||
|
_foundTargetPos = _sensorPos vectorAdd ((velocity _projectile) vectorMultiply 5);
|
||||||
|
} else {
|
||||||
|
TRACE_2("", _target, _foundTargetPos);
|
||||||
|
|
||||||
_adjustVelocity = (velocity _target) vectorMultiply _eta;
|
// @TODO: Configurable lead for seekers
|
||||||
_foundTargetPos = _foundTargetPos vectorAdd _adjustVelocity;
|
_projectileSpeed = (vectorMagnitude velocity _projectile);
|
||||||
|
_distanceToTarget = (getPosASL _projectile) vectorDistance _foundTargetPos;
|
||||||
|
|
||||||
|
_eta = _distanceToTarget / _projectileSpeed;
|
||||||
|
|
||||||
|
_adjustVelocity = (velocity _target) vectorMultiply _eta;
|
||||||
|
_foundTargetPos = _foundTargetPos vectorAdd _adjustVelocity;
|
||||||
|
};
|
||||||
|
|
||||||
|
*/
|
||||||
_foundTargetPos;
|
_foundTargetPos;
|
@ -1,4 +1,4 @@
|
|||||||
#define DEBUG_MODE_FULL
|
//#define DEBUG_MODE_FULL
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
|
EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
|
||||||
|
Loading…
Reference in New Issue
Block a user