Dir arc created.

This commit is contained in:
jaynus 2015-04-08 14:51:19 -07:00
parent 97febd6207
commit c89df1b04f
4 changed files with 64 additions and 21 deletions

View File

@ -1,4 +1,37 @@
#define DEBUG_MODE_FULL #define DEBUG_MODE_FULL
#include "script_component.hpp" #include "script_component.hpp"
_this call FUNC(attackProfile_LIN); EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"];
private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"];
_seekerTargetPos = _this select 0;
_launchParams = _this select 1;
_target = _launchParams select 0;
_targetLaunchParams = _launchParams select 1;
_shooterPos = getPosASL _shooter;
_projectilePos = getPosASL _projectile;
_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos;
_distanceToShooter = _projectilePos vectorDistance _shooterPos;
TRACE_2("", _distanceToTarget, _distanceToShooter);
_addHeight = [0,0,0];
if(_distanceToShooter < 100) then {
_addHeight = [0,0,_distanceToTarget];
} else {
_addHeight = [0,0, _distanceToTarget*0.02];
};
TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight);
_returnTargetPos = _seekerTargetPos vectorAdd _addHeight;
#ifdef DEBUG_MODE_FULL
drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]];
#endif
TRACE_1("Adjusted target position", _returnTargetPos);
_returnTargetPos;

View File

@ -2,8 +2,8 @@
#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);
private["_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams", "_targetPos", "_projectilePos"]; private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"];
private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"];
_seekerTargetPos = _this select 0; _seekerTargetPos = _this select 0;
_launchParams = _this select 1; _launchParams = _this select 1;
@ -13,16 +13,21 @@ _targetLaunchParams = _launchParams select 1;
_shooterPos = getPosASL _shooter; _shooterPos = getPosASL _shooter;
_projectilePos = getPosASL _projectile; _projectilePos = getPosASL _projectile;
_distanceToTarget = _projectilePos distance _seekerTargetPos; _distanceToTarget = _projectilePos vectorDistance _seekerTargetPos;
_distanceToShooter = _projectilePos distance _shooterPos; _distanceToShooter = _projectilePos vectorDistance _shooterPos;
_addHeight = [0,0,(_projectilePos distance _seekerTargetPos)*0.02]; TRACE_2("", _distanceToTarget, _distanceToShooter);
_seekerTargetPos = _seekerTargetPos vectorAdd _addHeight; //_addHeight = [0,0,0];
_addHeight = [0,0, _distanceToTarget*0.02];
TRACE_3("", _distanceToTarget, _distanceToShooter, _addHeight);
_returnTargetPos = _seekerTargetPos vectorAdd _addHeight;
#ifdef DEBUG_MODE_FULL #ifdef DEBUG_MODE_FULL
drawLine3D [(ASLtoATL _seekerTargetPos) vectorAdd _addHeight, ASLtoATL _seekerTargetPos, [0,1,0,1]]; drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]];
#endif #endif
TRACE_1("Adjusted target position", _seekerTargetPos); TRACE_1("Adjusted target position", _returnTargetPos);
_seekerTargetPos; _returnTargetPos;

View File

@ -2,8 +2,8 @@
#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);
private["_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams", "_targetPos", "_projectilePos"]; private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"];
private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos"];
_seekerTargetPos = _this select 0; _seekerTargetPos = _this select 0;
_launchParams = _this select 1; _launchParams = _this select 1;
@ -13,20 +13,25 @@ _targetLaunchParams = _launchParams select 1;
_shooterPos = getPosASL _shooter; _shooterPos = getPosASL _shooter;
_projectilePos = getPosASL _projectile; _projectilePos = getPosASL _projectile;
_distanceToTarget = _projectilePos distance _seekerTargetPos; _distanceToTarget = _projectilePos vectorDistance _seekerTargetPos;
_distanceToShooter = _projectilePos distance _shooterPos; _distanceToShooter = _projectilePos vectorDistance _shooterPos;
TRACE_2("", _distanceToTarget, _distanceToShooter); TRACE_2("", _distanceToTarget, _distanceToShooter);
_addHeight = [0,0,(_projectilePos distance _seekerTargetPos)*0.02]; _addHeight = [0,0,0];
if(_distanceToShooter < 100) then {
_addHeight = [0,0,_distanceToTarget];
} else {
_addHeight = [0,0, _distanceToTarget*0.02];
};
TRACE_1("", _addHeight); TRACE_3("", _distanceToTarget,_distanceToShooter,_addHeight);
_seekerTargetPos = _seekerTargetPos vectorAdd _addHeight; _returnTargetPos = _seekerTargetPos vectorAdd _addHeight;
#ifdef DEBUG_MODE_FULL #ifdef DEBUG_MODE_FULL
drawLine3D [(ASLtoATL _seekerTargetPos) vectorAdd _addHeight, ASLtoATL _seekerTargetPos, [0,1,0,1]]; drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]];
#endif #endif
TRACE_1("Adjusted target position", _seekerTargetPos); TRACE_1("Adjusted target position", _returnTargetPos);
_seekerTargetPos; _returnTargetPos;

View File

@ -30,7 +30,7 @@ if ( isNil "_attackProfile" || { ! ( _attackProfile in (getArray (_config >> "at
}; };
TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile); TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile);
[FUNC(guidancePFH), 0.1, [_this, [FUNC(guidancePFH), 0, [_this,
[ACE_player, [ACE_player,
[_target, _targetPos, _launchPos], [_target, _targetPos, _launchPos],
_seekerType, _seekerType,