Fix floating arrows

Fixes #1815
This commit is contained in:
ebaydayz
2016-12-10 14:57:23 -05:00
parent f18451ab48
commit d0e8291159

View File

@@ -1,4 +1,4 @@
private ["_endPos","_vUp","_doLoop","_hitArray","_countr","_hitObject","_hitSelection","_config","_hitMemoryPt","_variation","_val","_dir","_bolt","_obj","_unit","_ammo","_projectile","_height"];
private ["_endPos","_vUp","_doLoop","_hitArray","_countr","_hitObject","_hitSelection","_config","_hitMemoryPt","_variation","_val","_dir","_bolt","_obj","_unit","_ammo","_projectile","_height","_nearArrows"];
_obj = _this select 0;
_unit = _obj select 0;
//_weapon = _obj select 1;
@@ -17,6 +17,17 @@ while {alive _projectile} do {
sleep 0.01;
};
/*
Match near arrow position if one is already close by.
Prevents arrows floating in air when multiple are shot against wall at same position. Projectile was hitting end of previous arrow.
From testing anything less than 2m does not work to prevent this. Radius may need to be increased for some cases if issue still occurs.
*/
_nearArrows = nearestObjects [_endPos,["WoodenArrowF"],2];
if (count _nearArrows > 0) then {
_endPos = getPosATL (_nearArrows select 0);
_vUp = vectorUp (_nearArrows select 0);
};
//_distance = _unit distance _endPos;
_height = _endPos select 2;
_doLoop = true;
@@ -34,7 +45,7 @@ if (_height < 100) then {
if (count _hitArray > 0) then {_doLoop = false};
if (_countr > 50) then {_doLoop = false};
_countr = _countr + 1;
sleep 0.1;
uiSleep 0.1;
};
if (count _hitArray > 0) then {