params
private ["_vector"];
// calculate barrel vector at 0 deg. object angle
_vector =
[ (cos _pitchUp) * (sin _shootDir),
(cos _pitchUp) * (cos _shootDir),
(sin _pitchUp) ];
return vectorNormalized _vector;
}
_barrelpitch
};
llw_shoot =
_barreldir
params ["_objShooter","_barrelpitch","_barreldir","_shellType","_charge"];
private ["_barrelHeight","_milsPerDegree","_pitch","_spawnPoint","_objShell","_fireVector"];
// magic numbers
_milsPerDegree =
_barrelroll
// preparatory calculations
// TODO: change spawnpoint function to barrel exit vertex
_muzzleHeight =
_charge
_spawnPoint =
_theshell
_spawnPoint set [2, _muzzleHeight];
_vector =
// spawn and launch
_objShell = _shellType createVehicle
//barrelpitch = 819;
_pitchdegrees = _barrelpitch / 17.777777;
//_charge = 314;
_theshell setdir _barreldir;
[_theshell, _pitchdegrees, 0] call BIS_fnc_setPitchBank;
_startvelocity =
_theshell
_objShell setVectorDirAndUp [_vector,_vector];
_objShell setVelocity
_objShell
/* hint (["Variables"
,"\nObject", _objShooter
,"\nBarrelpitch",_barrelpitch
,"\nBarreldir",_barreldir
,"\nShelltype",_shellType
,"\nSpawnPoint",_spawnPoint
,"\nVector",_vector
,"\nobjShell",_objShell
] joinString " : "); */
};
/////////////////////////////////////////////
// AFTER THIS BLOCK, ONLY FOR TESTING
/////////////////////////////////////////////
arty = vehicle player;
player allowDamage false;
arty allowDamage false;
onEachFrame
{
_beg = ASLToAGL eyePos arty;
_endE = (_beg vectorAdd (eyeDirection arty vectorMultiply 100));
drawLine3D [ _beg, _endE, [0,1,0,1]];
_endW = (_beg vectorAdd (arty weaponDirection currentWeapon arty vectorMultiply 100));
drawLine3D [_beg, _endW, [1,0,0,1]];
};
// shell = [ arty, 45, direction arty, "LLW_81mm_HEPD_004", 1 ] call
shell = [ arty, 45, direction arty, "Sh_82mm_AMOS", 10 ] call llw_shoot;
hint str velocity
//player attachto [_theshell, [0,0,0]];