Skip to content

Commit

Permalink
ProjectileTracking - Stop tracking stationary objects (#985)
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror authored and commy2 committed Sep 17, 2018
1 parent e13258f commit 4dc1986
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions addons/diagnostic/fnc_projectileTracking_trackProjectile.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ params ["_args", "_handle"];
_args params ["_projectile", "_index", "_initialProjectileData"];

if (!isNull _projectile) then {
private _speed = vectorMagnitude velocity _projectile;
if (_speed < 0.1) then { // If projectile is slowed down, stop tracking after this run
[_handle] call CBA_fnc_removePerFrameHandler;
};

private _data = [];
private _bulletData = [];
Expand All @@ -39,13 +43,9 @@ if (!isNull _projectile) then {
} else {
_bulletData = [_initialProjectileData];
_data = [_handle, _bulletData];
GVAR(projectileData) set [_index, _data];
};

_bulletData pushBack [(getPos _projectile), vectorMagnitude (velocity _projectile)];

_data set [1, _bulletData];

GVAR(projectileData) set [_index, _data];
_bulletData pushBack [(getPos _projectile), _speed];

} else {
[_handle] call CBA_fnc_removePerFrameHandler;
Expand Down

0 comments on commit 4dc1986

Please sign in to comment.