mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
742626ff1a
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
26 lines
629 B
Plaintext
26 lines
629 B
Plaintext
#include "..\script_component.hpp"
|
|
/*
|
|
* Author: jaynus / nou
|
|
* Change a projectile's direction, maintaing speed
|
|
*
|
|
* Arguments:
|
|
* 0: Projectile <OBJECT>
|
|
* 1: Direction (unit vector) <ARRAY>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [missile, [0,1,0]] call ace_missileguidance_fnc_changeMissileDirection;
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
params ["_projectile", "_v"];
|
|
|
|
private _l = sqrt ((_v select 0) ^ 2 + (_v select 1) ^ 2);
|
|
private _r = -(_v select 2) / _l;
|
|
|
|
_projectile setVectorDirAndUp [ _v, [(_v select 0) * _r,(_v select 1) * _r, _l] ];
|
|
_projectile setVelocity (_v vectorMultiply (vectorMagnitude (velocity _projectile)));
|