2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-09-19 18:55:35 +00:00
|
|
|
* Author: Bohemia Interactive edit by KoffeinFlummi
|
|
|
|
* Sets the value of an ACE_Parameter and makes it public.
|
2015-01-12 04:02:33 +00:00
|
|
|
*
|
2015-01-11 16:42:31 +00:00
|
|
|
* Arguments:
|
2015-09-19 18:55:35 +00:00
|
|
|
* 0: Unit/Vehicle <OBJECT>
|
|
|
|
* 1: Pitch <NUMBER>
|
|
|
|
* 2: Yaw <NUMBER>
|
|
|
|
* 3: Bank <NUMBER>
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
2015-09-19 18:55:35 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [bob, 1, 2, 3] call ace_common_fnc_setPitchBankYaw
|
|
|
|
*
|
2015-09-19 18:55:35 +00:00
|
|
|
* Public: Yes
|
2015-01-11 16:42:31 +00:00
|
|
|
*/
|
|
|
|
|
2015-09-19 18:55:35 +00:00
|
|
|
params ["_object", "_aroundX", "_aroundY", "_aroundZ"];
|
|
|
|
|
|
|
|
_aroundZ = - _aroundZ;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-12-14 12:08:19 +00:00
|
|
|
private _dirX = 0;
|
|
|
|
private _dirY = 1;
|
|
|
|
private _dirZ = 0;
|
|
|
|
private _upX = 0;
|
|
|
|
private _upY = 0;
|
|
|
|
private _upZ = 1;
|
2015-09-19 18:55:35 +00:00
|
|
|
|
2015-01-12 04:02:33 +00:00
|
|
|
if (_aroundX != 0) then {
|
2015-09-19 18:55:35 +00:00
|
|
|
_dirY = cos _aroundX;
|
|
|
|
_dirZ = sin _aroundX;
|
|
|
|
_upY = -sin _aroundX;
|
|
|
|
_upZ = cos _aroundX;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
2015-09-19 18:55:35 +00:00
|
|
|
|
2015-01-12 04:02:33 +00:00
|
|
|
if (_aroundY != 0) then {
|
2015-09-19 18:55:35 +00:00
|
|
|
_dirX = _dirZ * sin _aroundY;
|
|
|
|
_dirZ = _dirZ * cos _aroundY;
|
|
|
|
_upX = _upZ * sin _aroundY;
|
|
|
|
_upZ = _upZ * cos _aroundY;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
2015-09-19 18:55:35 +00:00
|
|
|
|
2015-01-12 04:02:33 +00:00
|
|
|
if (_aroundZ != 0) then {
|
2015-12-14 12:08:19 +00:00
|
|
|
private _dirXTemp = _dirX;
|
2015-09-19 18:55:35 +00:00
|
|
|
_dirX = (_dirXTemp* cos _aroundZ) - (_dirY * sin _aroundZ);
|
|
|
|
_dirY = (_dirY * cos _aroundZ) + (_dirXTemp * sin _aroundZ);
|
|
|
|
|
2015-12-14 12:08:19 +00:00
|
|
|
private _upXTemp = _upX;
|
2015-09-19 18:55:35 +00:00
|
|
|
_upX = (_upXTemp * cos _aroundZ) - (_upY * sin _aroundZ);
|
|
|
|
_upY = (_upY * cos _aroundZ) + (_upXTemp * sin _aroundZ);
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
2015-12-14 12:08:19 +00:00
|
|
|
private _dir = [_dirX, _dirY, _dirZ];
|
|
|
|
private _up = [_upX, _upY, _upZ];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_object setVectorDirAndUp [_dir,_up];
|