Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // nul = [[object array], [pitch, bank, yaw], height] execVM "relative_rotation.sqf"
- // example: [[obj1, obj2], [90, 0, 0], 0] execVM "relative_rotation.sqf";
- private _InputObjects = _this select 0;
- private _PitchAmount = (_this select 1) select 0;
- private _BankAmount = (_this select 1) select 1;
- private _YawAmount = (_this select 1) select 2;
- private _AdjustHeight = _this select 2;
- // https://community.bistudio.com/wiki/BIS_fnc_setPitchBank ffur2007slx2_5
- fnc_SetPitchBankYaw =
- {
- private ["_object","_rotations","_aroundX","_aroundY","_aroundZ","_dirX","_dirY","_dirZ","_upX","_upY","_upZ","_dir","_up","_dirXTemp",
- "_upXTemp"];
- _object = _this select 0;
- _rotations = _this select 1;
- _aroundX = _rotations select 0;
- _aroundY = _rotations select 1;
- _aroundZ = (360 - (_rotations select 2)) - 360;
- _dirX = 0;
- _dirY = 1;
- _dirZ = 0;
- _upX = 0;
- _upY = 0;
- _upZ = 1;
- if (_aroundX != 0) then {
- _dirY = cos _aroundX;
- _dirZ = sin _aroundX;
- _upY = -sin _aroundX;
- _upZ = cos _aroundX;
- };
- if (_aroundY != 0) then {
- _dirX = _dirZ * sin _aroundY;
- _dirZ = _dirZ * cos _aroundY;
- _upX = _upZ * sin _aroundY;
- _upZ = _upZ * cos _aroundY;
- };
- if (_aroundZ != 0) then {
- _dirXTemp = _dirX;
- _dirX = (_dirXTemp* cos _aroundZ) - (_dirY * sin _aroundZ);
- _dirY = (_dirY * cos _aroundZ) + (_dirXTemp * sin _aroundZ);
- _upXTemp = _upX;
- _upX = (_upXTemp * cos _aroundZ) - (_upY * sin _aroundZ);
- _upY = (_upY * cos _aroundZ) + (_upXTemp * sin _aroundZ);
- };
- _dir = [_dirX,_dirY,_dirZ];
- _up = [_upX,_upY,_upZ];
- _object setVectorDirAndUp [_dir,_up];
- };
- {
- private _pos = position _x;
- private _pinObj = "Sign_Arrow_Large_Blue_F" createVehicle position _x;
- _pinObj setDir getDir _x;
- _pinObj setPos position _x;
- _pinObj setVectorDir vectorDir _x;
- _pinObj setVectorUp vectorUp _x;
- _x setPos [_pos select 0, _pos select 1, (_pos select 2) + _AdjustHeight];
- private _attached = [_x, _pinObj] call BIS_fnc_attachToRelative;
- private _adjusted = [_x, [_PitchAmount, _BankAmount, _YawAmount]] call fnc_SetPitchBankYaw;
- sleep 1;
- detach _x;
- deleteVehicle _pinObj;
- } forEach _InputObjects;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement