ACE3/addons/missileguidance/functions/fnc_changeMissileDirection.sqf
2015-04-14 09:36:39 -07:00

11 lines
384 B
Plaintext

#include "script_component.hpp"
private ["_projectile", "_v", "_l", "_r"];
_projectile = _this select 0;
_v = _this select 1;
_l = sqrt ((_v select 0) ^ 2 + (_v select 1) ^ 2);
_r = -(_v select 2) / _l;
_projectile setVectorDirAndUp [ _v, [(_v select 0) * _r,(_v select 1) * _r, _l] ];
_projectile setVelocity (_v vectorMultiply (vectorMagnitude (velocity _projectile)));