mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix hellfire firing without lock. Change LOS navigation type
This commit is contained in:
parent
d6c5bcd025
commit
e54e6ec254
@ -22,7 +22,7 @@ _args params ["_firedEH", "_launchParams", "_flightParams", "", "_stateParams"];
|
||||
_stateParams params ["", "_seekerStateParams"];
|
||||
_launchParams params ["","_targetLaunchParams","_seekerType"];
|
||||
|
||||
_targetLaunchParams params ["", "", "_launchPos"];
|
||||
_targetLaunchParams params ["", "", "_launchPos", "_launchDir"];
|
||||
_firedEH params ["","","","","","","_projectile"];
|
||||
|
||||
// Get state params:
|
||||
@ -37,6 +37,10 @@ private _heightAboveLaunch = (_projectilePos select 2) - (_launchPos select 2);
|
||||
|
||||
// Add height depending on distance for compensate
|
||||
private _returnTargetPos = _seekerTargetPos;
|
||||
if (_returnTargetPos isEqualTo [0, 0, 0]) then {
|
||||
_initialDistanceToTarget = 8000;
|
||||
_returnTargetPos = _launchPos vectorAdd (_launchDir vectorMultiply _initialDistanceToTarget);
|
||||
};
|
||||
|
||||
private _closingRate = vectorMagnitude velocity _projectile;
|
||||
private _timeToGo = (_projectilePos distance _seekerTargetPos) / _closingRate;
|
||||
@ -52,6 +56,7 @@ private _atMinRotationAngle = _angleToTarget >= (0.5 * _pitchRate * _timeToGo);
|
||||
switch (_attackStage) do {
|
||||
case STAGE_LAUNCH: { // Gain height quickly to pass terrain mask
|
||||
_missileStateData params ["_heightBeforeStateSwitch", "_initialDistanceToTarget"];
|
||||
|
||||
_returnTargetPos set [2, _heightBeforeStateSwitch + (_initialDistanceToTarget * sin 20)]; // 100 and 36.4 gives a 20 deg angle
|
||||
|
||||
if (_heightAboveLaunch > _configLaunchHeightClear) then {
|
||||
@ -70,6 +75,7 @@ switch (_attackStage) do {
|
||||
};
|
||||
case STAGE_SEEK_CRUISE: { // Slowly gain altitude while searching for target
|
||||
_missileStateData params ["_heightBeforeStateSwitch", "_initialDistanceToTarget"];
|
||||
|
||||
// Before 4000 cruise at 5.7 degrees up, then level out
|
||||
_returnTargetPos set [2, _heightBeforeStateSwitch + (_initialDistanceToTarget * sin 5.7)];
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
#define COMPONENT_BEAUTIFIED Laser
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#define DRAW_LASER_INFO
|
||||
// #define DRAW_LASER_INFO
|
||||
// #define DEBUG_MODE_FULL
|
||||
#define DISABLE_COMPILE_CACHE
|
||||
// #define DISABLE_COMPILE_CACHE
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
||||
#ifdef DEBUG_ENABLED_LASER
|
||||
|
@ -59,10 +59,17 @@ if ((_pitchRate != 0 || {_yawRate != 0}) && {_profileAdjustedTargetPos isNotEqua
|
||||
|
||||
_commandedAcceleration = _projectile vectorWorldToModelVisual _commandedAcceleration;
|
||||
_commandedAcceleration params ["_yawChange", "", "_pitchChange"];
|
||||
|
||||
if (isNil "_yawChange") then {
|
||||
_yawChange = 0;
|
||||
};
|
||||
if (isNil "_pitchChange") then {
|
||||
_pitchChange = 0;
|
||||
};
|
||||
|
||||
private _clampedPitch = (_pitchChange min _pitchRate) max -_pitchRate;
|
||||
private _clampedYaw = (_yawChange min _yawRate) max -_yawRate;
|
||||
|
||||
|
||||
// controls are either on or off, no proportional
|
||||
if (_isBangBangGuidance) then {
|
||||
private _pitchSign = if (_clampedPitch == 0) then {
|
||||
|
@ -14,9 +14,33 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
params ["_args", "", "", "_profileAdjustedTargetPos"];
|
||||
_args params ["_firedEH"];
|
||||
params ["_args", "_timestep", "_seekerTargetPos", "_profileAdjustedTargetPos"];
|
||||
_args params ["_firedEH", "", "", "", "_stateParams"];
|
||||
_firedEH params ["","","","","","","_projectile"];
|
||||
_stateParams params ["", "", "", "","_navigationParams"];
|
||||
_navigationParams params [["_lastLineOfSight", [0, 0, 0]]];
|
||||
|
||||
// Semi-proportional navigation implemented via "Fundamentals of proportional navigation" by Stephen Murtaugh and Harry Criel
|
||||
private _lineOfSight = vectorNormalized (_profileAdjustedTargetPos vectorDiff getPosASLVisual _projectile);
|
||||
_lineOfSight vectorMultiply 50
|
||||
|
||||
// the los rate is tiny, so we multiply by a constant of a power of ten to get more aggressive acceleration
|
||||
// this is just due to how we measure our LOS delta, the vectors involved are _tiny_
|
||||
private _losDelta = _lineOfSight vectorDiff _lastLineOfSight;
|
||||
private _losRate = if (_timestep == 0) then {
|
||||
0
|
||||
} else {
|
||||
10 * (vectorMagnitude _losDelta) / _timestep;
|
||||
};
|
||||
|
||||
private _commandedAcceleration = (velocity _projectile) vectorMultiply _losRate;
|
||||
TRACE_5("LOS NAV",_commandedAcceleration,_projectile,_losRate,_lineOfSight,_lastLineOfSight);
|
||||
|
||||
// we need acceleration normal to our LOS
|
||||
private _commandedAccelerationProjected = _lineOfSight vectorMultiply (_commandedAcceleration vectorDotProduct _lineOfSight);
|
||||
_commandedAcceleration = _commandedAcceleration vectorDiff _commandedAccelerationProjected;
|
||||
|
||||
if (accTime > 0) then {
|
||||
_navigationParams set [0, _lineOfSight];
|
||||
};
|
||||
|
||||
_commandedAccelerationProjected
|
||||
|
@ -119,7 +119,7 @@ private _pitchYaw = (vectorDir _projectile) call CBA_fnc_vect2Polar;
|
||||
TRACE_5("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile,_navigationType);
|
||||
private _args = [_this,
|
||||
[ _shooter,
|
||||
[_target, _targetPos, _launchPos],
|
||||
[_target, _targetPos, _launchPos, vectorDirVisual vehicle _shooter],
|
||||
_seekerType,
|
||||
_attackProfile,
|
||||
_lockMode,
|
||||
@ -141,26 +141,26 @@ private _args = [_this,
|
||||
];
|
||||
|
||||
private _onFiredFunc = getText (configFile >> QGVAR(SeekerTypes) >> _seekerType >> "onFired");
|
||||
TRACE_1("",_onFiredFunc);
|
||||
TRACE_1("seeker on fired",_onFiredFunc);
|
||||
if (_onFiredFunc != "") then {
|
||||
_args call (missionNamespace getVariable _onFiredFunc);
|
||||
};
|
||||
|
||||
_onFiredFunc = getText (configFile >> QGVAR(AttackProfiles) >> _attackProfile >> "onFired");
|
||||
TRACE_1("",_onFiredFunc);
|
||||
TRACE_1("attack on fired",_onFiredFunc);
|
||||
if (_onFiredFunc != "") then {
|
||||
_args call (missionNamespace getVariable _onFiredFunc);
|
||||
};
|
||||
|
||||
_onFiredFunc = getText (configFile >> QGVAR(NavigationTypes) >> _navigationType >> "onFired");
|
||||
TRACE_1("",_onFiredFunc);
|
||||
TRACE_1("navigation on fired",_onFiredFunc);
|
||||
if (_onFiredFunc != "") then {
|
||||
_args call (missionNamespace getVariable _onFiredFunc);
|
||||
};
|
||||
|
||||
// Run the "onFired" function passing the full guidance args array
|
||||
_onFiredFunc = getText (_config >> "onFired");
|
||||
TRACE_1("",_onFiredFunc);
|
||||
TRACE_1("general on fired",_onFiredFunc);
|
||||
if (_onFiredFunc != "") then {
|
||||
_args call (missionNamespace getVariable _onFiredFunc);
|
||||
};
|
||||
@ -169,7 +169,7 @@ if (_onFiredFunc != "") then {
|
||||
// _args params ["_firedEH", "_launchParams", "_flightParams", "_seekerParams", "_stateParams"];
|
||||
// _firedEH params ["_shooter","","","","_ammo","","_projectile"];
|
||||
// _launchParams params ["_shooter","_targetLaunchParams","_seekerType","_attackProfile","_lockMode","_laserInfo","_navigationType"];
|
||||
// _targetLaunchParams params ["_target", "_targetPos", "_launchPos"];
|
||||
// _targetLaunchParams params ["_target", "_targetPos", "_launchPos"m "_launchDir"];
|
||||
// _stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState","_navigationParams"];
|
||||
// _seekerParams params ["_seekerAngle", "_seekerAccuracy", "_seekerMaxRange", "_seekerMinRange"];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user