diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 606652ca2..f22468134 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -218,6 +218,11 @@ _object setVectorUp _vectorUp; }] call CBA_fnc_addEventHandler; +[QGVAR(setVectorDirAndUp), { + params ["_object", "_dirAndUp"]; + _object setVectorDirAndUp _dirAndUp; +}] call CBA_fnc_addEventHandler; + [QGVAR(setVelocity), { params ["_object", "_velocity"]; _object setVelocity _velocity; diff --git a/addons/modules/functions/fnc_moduleAttachTo.sqf b/addons/modules/functions/fnc_moduleAttachTo.sqf index f341750ae..022a1dca4 100644 --- a/addons/modules/functions/fnc_moduleAttachTo.sqf +++ b/addons/modules/functions/fnc_moduleAttachTo.sqf @@ -44,10 +44,10 @@ if (!isNull attachedTo _object) exitWith { [LSTRING(CannotAttachToSelf)] call EFUNC(common,showMessage); }; - private _direction = getDir _object - getDir _entity; + private _dirAndUp = [_entity vectorWorldToModel vectorDir _object, _entity vectorWorldToModel vectorUp _object]; _object attachTo [_entity]; - [QEGVAR(common,setDir), [_object, _direction], _object] call CBA_fnc_targetEvent; + [QEGVAR(common,setVectorDirAndUp), [_object, _dirAndUp], _object] call CBA_fnc_targetEvent; [LSTRING(ObjectAttached)] call EFUNC(common,showMessage); }, [], LSTRING(ModuleAttachTo)] call EFUNC(common,selectPosition);