Skip to content

Instantly share code, notes, and snippets.

@commy2
Last active July 26, 2021 10:27
Show Gist options
  • Save commy2/d60b11fd38cf53f5c2ec02cda0dc3426 to your computer and use it in GitHub Desktop.
Save commy2/d60b11fd38cf53f5c2ec02cda0dc3426 to your computer and use it in GitHub Desktop.
CBA_fnc_get3DENRotation = {
params ["_object"];
private _dir = vectorDir _object;
_dir params ["_xDir", "_yDir", "_zDir"];
private _up = vectorUp _object;
_up params ["_xUp", "_yUp", "_zUp"];
private _side = _dir vectorCrossProduct _up;
_side params ["_xSide", "_ySide", "_zSide"];
private _xRot = _yUp atan2 _zUp;
private _yRot = -_xUp atan2 sqrt (1 - (_xUp ^ 2));
private _zRot = _xDir atan2 _xSide;
[_xRot, _yRot, _zRot]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment