Advertisement
Faguss

Rotate3d

Oct 17th, 2016
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. private ["_vehicle", "_dir", "_pos", "_yaw", "_bank", "_pitch", "_side", "_y", "_z", "_xy", "_xz", "_yz", "_yx", "_zx", "_zy"];
  2.  
  3.  
  4. _vehicle = _this select 0;
  5. _dir = getDir2 _vehicle;
  6. _pos = getPosASL _vehicle;
  7.  
  8. //_yaw = getdir _vehicle;
  9. //_yaw = -_yaw;
  10. //_bank1 = (vehicle player) call GetBank;
  11. //_pitch1 = (vehicle player) call GetPitch;
  12.  
  13. _yaw = -(_dir select 0);
  14. _bank = _dir select 1;
  15. _pitch = _dir select 2;
  16.  
  17. //player globalchat format ["%1 %2 %3 %4", _pitch1, _pitch, abs (_pitch1 - _pitch),DUPA];
  18. //if (abs (_pitch1 - _pitch) > DUPA && abs (_pitch1 - _pitch) < 900 ) then {DUPA=abs (_pitch1 - _pitch)};
  19.  
  20. //player globalchat format ["%1 %2 %3", _bank1, _bank, abs (_bank1 - _bank)];
  21. //if (abs (_bank1 - _bank) > DUPA && abs (_bank1 - _bank) < 900 ) then {DUPA=abs (_bank1 - _bank)};
  22.  
  23.  
  24. _side = _this select 1;
  25. _forward = _this select 2;
  26. _up = _this select 3;
  27.  
  28.  
  29. // Rotation around the X axis
  30. _xy = cos(_pitch)*_forward - sin(_pitch)*_up;
  31. _xz = sin(_pitch)*_forward + cos(_pitch)*_up;
  32.  
  33. // Rotation around the Y axis
  34. _yz = cos(_bank)*_xz - sin(_bank)*_side;
  35. _yx = sin(_bank)*_xz + cos(_bank)*_side;
  36.  
  37. // Rotation around the Z axis
  38. _zx = cos(_yaw)*_yx - sin(_yaw)*_xy;
  39. _zy = sin(_yaw)*_yx + cos(_yaw)*_xy;
  40.  
  41. [
  42. (_pos select 0) + _zx,
  43. (_pos select 1) + _zy,
  44. (_pos select 2) + _yz
  45. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement